home *** CD-ROM | disk | FTP | other *** search
- /*
- * このモジュールは,NIFPのサブルーチン部です。主にファイル処理と画面表示とキー入力を
- * 処理します。
- * このモジュールは,マシン依存しています。
- *
- * このモジュール中でPC88VAに関するソースは Nifty-Serve ID:NBB00541 てんか☆(北
- * 村)が作成しました。
- */
-
- #include "nifp.h"
- #include <signal.h>
-
- char savepflag=0,erron=0;
- #ifdef FMR
- #define RTN_CODE 0x1f
- #define TAB_CODE 0x1c
- #define KEYMAX 24
- static char pfkeyset[2];
- char keygettbl[KEYMAX][16];
- char keysettbl[KEYMAX*2] = { 0x01,'1',0x02,'2',0x03,'3',0x04,'4',0x05,'5',
- 0x06,'6',0x07,'7',0x08,'8',0x09,'9',0x0a,':',
- 0x0b,';',0x1d,'<',0x21,'=',0x22,'>',0x23,'?',
- 0x24,'@',0x25,'A',0x26,'B',0x27,'C',0x28,'D',
- 0x16,'E',0x17,'F' };
- #define KEY2MAX 11
- char keyget2tbl[KEY2MAX][10];
- char keyset2tbl[KEY2MAX*3] = { 0x08,0x08,0x09,0x09,0x0b,0x0b,0x0c,0x0c,
- 0x0d,0x0d,0x1b,0x1b,0x1c,0x1c,0x1d,0x1d,
- 0x1e,0x1e,0x1f,0x1f,0x7f,0x00 };
- unsigned int pftbl[4];
- char pfdata[70],pfsdata[70],pfcdata[70],pfscdata[70],pfadata[70];
- struct ATR {
- char moji,atr;
- unsigned int color;
- } pfatr[70],pfsatr[70],pfcatr[70],pfscatr[70],pfaatr[70];
- int atr1=0x07;
- static char machineinfo[16];
- static char dispmode=0;
- #endif
- #ifdef PC_98
- #define RTN_CODE 0x1f
- #define TAB_CODE 0x1c
- char pfdata[250],pfsdata[250],pfcdata[250],pfscdata[250],pfadata[250];
- char atr=0xe1;
- long vramadr = 0xa000;
- long vramatr = 0xa200;
- #endif
- #ifdef PC_AT
- #define RTN_CODE 0x1b
- #define RTNAX_CODE 0x05
- #define TAB_CODE 0x1e
- #define AT 0
- #define AX 1
- #define DOSV 2
- #define J3100 3
- int at_keta = 80;
- int at_line = 25;
- char actpage = 8;
- char pfdata[300],pfsdata[300],pfcdata[300],pfscdata[300],pfadata[300];
- char atr=0x07;
- long vramadr = 0xb800;
- static char dispmode=AT;
- static int cslmode = 0;
- static char sclmode = 0;
- #endif
- int saveshift=0;
- time_t lsavetime[1];
-
-
- #ifdef PC88VA
- /* VA : MSE の モード */
- #define VA_PC9801 -2 /* not VA */
- #define VA_NOMSE -1
- #define VA_NATIVE 0
- #define VA_STD 1
- #define VA_TEXT98 2
- #define VA_TEXT98K 3
- #define VA_MONO98 4
- #define VA_GRPH98 5
-
- static char dflt_atr = 0xE1;
- static int saveMseMode = VA_PC9801;
- #endif
-
- static int xint86(char i)
- {
- return(int86(i,®s,®s));
- }
-
- static int xint86x(char i)
- {
- return(int86x(i,®s,®s,&sregs));
- }
-
- static int xint90(void)
- {
- return(xint86(0x90));
- }
-
- static int xint91(void)
- {
- return(xint86(0x91));
- }
-
- static int xint90x(void)
- {
- return(xint86x(0x90));
- }
-
- static int xint91x(void)
- {
- return(xint86x(0x91));
- }
-
- static int xintdos(void)
- {
- return(intdos(®s,®s));
- }
-
- #ifdef PC88VA
- static int Va_ChkVA(void)
- {
- return (*((unsigned char far *)0xffff000fL) == 0xff);
- }
-
- static int Va_GetMseMode(void)
- {
- /* if (Va_ChkVA() == 0)
- return(VA_PC9801); */
- regs.x.cx = -1;
- regs.x.ax = 0x44e5;
- regs.h.dl = 0xff;
- xintdos();
- if ((int)(regs.x.cx) != -1) {
- return ((regs.h.dh < 0x40) ? VA_STD :
- ((regs.h.dh < 0x80) ? ((regs.h.dh&0x10) ? VA_TEXT98K:VA_TEXT98):
- ((regs.h.dh == 0x80) ? VA_MONO98: VA_GRPH98)));
- }
- regs.x.ax = 0x7f00;
- xintdos();
- regs.x.cx = -1;
- regs.x.ax = 0x44e5;
- regs.h.dl = 0xff;
- xintdos();
- if ((int)(regs.x.cx) == -1)
- return(VA_NOMSE);
- regs.x.ax = 0x7f01;
- xintdos();
- return(VA_NATIVE);
- }
-
- static int Va_SetMseMode(int mode)
- {
- if (mode == VA_NATIVE) {
- regs.x.ax = 0x7f01;
- xintdos();
- return(0);
- }
- regs.x.ax = 0x7f00;
- xintdos();
- regs.x.cx = 0;
- regs.x.ax = 0x44e5;
- regs.h.dl = 0x00;
- regs.h.dh = ((mode == VA_STD) ? 0x00 :
- ((mode == VA_TEXT98) ? 0x45 :
- ((mode == VA_TEXT98K)? 0x45|0x10 :
- ((mode == VA_MONO98) ? 0x80 :
- ((mode == VA_GRPH98) ? 0x85 : 0xFF)))));
- if (regs.h.dh == 0xFF)
- return(-1);
- xintdos();
- return(0);
- }
-
- static void Va_FuncKeySw(int n)
- /* n = 0: モジレツ テンカイ スル 1:シナイ */
- {
- regs.x.ax = 0x0200+(n & 0x01);
- xint86(0x82);
- }
- #endif
-
- #ifdef FMR
- static unsigned xjmstojis(unsigned c)
- {
- int h,l;
-
- h = c/256;
- l = c%256;
- h -= (h <= 0x9f) ? 0x71 : 0xb1;
- h = h * 2 + 1;
- if(l > 0x7f) l--;
- if(l >= 0x9e) {
- l -= 0x7d;
- h++;
- }
- else l -= 0x1f;
- return(h*256+l);
- }
- #endif
-
- void loc(int x,int y) /* カーソル位置設定 */
- {
- gyo = y;
- keta = x;
- #ifdef FMR
- if(dispmode)
- vramoffset = ((y-1)*160 + (x-1)*2);
- else {
- regs.h.ah = 0x0d;
- regs.h.dh = y;
- regs.h.dl = x;
- xint91();
- }
- #endif
- #ifdef PC_98
- vramoffset = ((y-1)*160 + (x-1)*2);
- #endif
- #ifdef PC_AT
- if(dispmode)
- vramoffset = ((y-1)*at_keta*2 + (x-1)*2);
- else {
- regs.h.ah = 0x02;
- regs.h.bh = actpage;
- regs.h.dh = y-1;
- regs.h.dl = x-1;
- xint86(0x10);
- }
- #endif
- }
-
- void locate(int x,int y) /* カーソル位置設定 */
- {
- loc(x,y);
- #ifndef PC_AT
- printf("\033[%d;%dH",y,x);
- #else
- regs.h.ah = 0x02;
- regs.h.bh = actpage;
- regs.h.dh = y-1;
- regs.h.dl = x-1;
- xint86(0x10);
- #endif
- }
-
- void xlocate2(void) /* カーソル最終行位置設定 */
- {
- locate(1,line-1);
- }
-
- void xlocate(void) /* カーソル最終行位置設定 & 行クリア */
- {
- xlocate2();deforutoiro();clr();
- }
-
- #ifdef PC_AT
- static void dosv_disp(long off,int c) /* 画面表示の更新 */
- {
- regs.h.ah = 0xff; /* 疑似ビデオ・バッファをグラフィックVRAM に転送 */
- sregs.es = (unsigned)vramadr;
- regs.x.di = (unsigned)off;
- regs.x.cx = (unsigned)c;
- xint86x(0x10);
- }
- #endif
-
- void scroll(int mode,int x1,int y1,int x2,int y2) /* スクロール */
- {
- #ifdef FMR
- regs.h.ah = 0x1a;
- regs.h.al = mode;
- regs.x.cx = 1;
- regs.h.dh = y1;
- regs.h.dl = x1;
- regs.h.bh = y2;
- regs.h.bl = x2;
- xint91();
- #endif
- #ifdef PC_98
- int y,x;
- int far *ap;
- int far *atp;
- int far *bp;
- int far *btp;
-
- if(mode) {
- ap = (int far *)(MK_FP(vramadr,(y2-2)*160));
- atp = (int far *)(MK_FP(vramatr,(y2-2)*160));
- for(y = y2-1; y >= y1; y--) {
- bp = ap + 80;
- btp = atp + 80;
- for(x = x1-1; x < x2;x++) {
- *(bp+x) = *(ap+x);
- *(btp+x) = *(atp+x);
- }
- ap -= 80;
- atp -= 80;
- }
- ap = (int far *)(MK_FP(vramadr,(y1-1)*160));
- atp = (int far *)(MK_FP(vramatr,(y1-1)*160));
- for(x = x1-1; x < x2;x++) {
- *(ap+x) = 0;
- #ifdef PC88VA
- *(atp+x) = dflt_atr;
- #else
- *(atp+x) = 0x00e1;
- #endif
- }
- }
- else {
- ap = (int far *)(MK_FP(vramadr,(y1-1)*160));
- atp = (int far *)(MK_FP(vramatr,(y1-1)*160));
- for(y = y1-1; y < y2-1; y++) {
- bp = ap + 80;
- btp = atp + 80;
- for(x = x1-1; x < x2;x++) {
- *(ap+x) = *(bp+x);
- *(atp+x) = *(btp+x);
- }
- ap += 80;
- atp += 80;
- }
- ap = (int far *)(MK_FP(vramadr,(y2-1)*160));
- atp = (int far *)(MK_FP(vramatr,(y2-1)*160));
- for(x = x1-1; x < x2;x++) {
- *(ap+x) = 0;
- #ifdef PC88VA
- *(atp+x) = dflt_atr;
- #else
- *(atp+x) = 0x00e1;
- #endif
- }
- }
- #endif
- #ifdef PC_AT
- int y,x;
-
- if(mode) { /* スクロールダウン */
- regs.x.ax = 0x0701;
- regs.h.bh = 0;
- regs.h.ch = y1-1;
- regs.h.cl = x1-1;
- regs.h.dh = y2-1;
- regs.h.dl = x2-1;
- xint86(0x10);
- }
- else { /* スクロールアップ */
- regs.x.ax = 0x0601;
- regs.h.bh = 0;
- regs.h.ch = y1-1;
- regs.h.cl = x1-1;
- regs.h.dh = y2-1;
- regs.h.dl = x2-1;
- xint86(0x10);
- }
- #endif
- }
-
- int getline(void) /* 画面行数読み取り */
- {
- #ifdef FMR
- regs.h.ah = 0x04;
- xint91();
- return((int)regs.h.dh);
- #endif
- #ifdef PC_98
- #ifdef PC88VA
- if (vrammode == 3) {
- regs.h.ah = 0x0b;
- xint86(0x18);
- if(regs.h.al & 0x01)
- return(20);
- return(25);
- } else {
- #endif
- unsigned char far *nec_line = (unsigned char far *)0x000712L;
- int c;
-
- c = (int)*nec_line;
- if(!vrammode) {
- if(c > 25) c++;
- }
- return(c+1);
- #ifdef PC88VA
- }
- #endif
- #endif
- #ifdef PC_AT
- unsigned char far *ibm_keta = (unsigned char far *)0x40004aL;
- unsigned char far *ibm_line = (unsigned char far *)0x400084L;
-
- at_keta = (int)*ibm_keta;
- at_line = (int)*ibm_line + 1;
- return(at_line);
- #endif
- }
-
- static char ctlcsave=0;
- static void (*savesignal)();
-
- void sigint_ent(void)
- {
- signal(SIGINT,(void (*)())sigint_ent);
- }
-
-
- int defline = 0;
- void setcon(int mode) /* 画面情報設定 */
- {
- #ifdef FMR
- int i;
- int n;
- if(vrammode >= 2) n = 10;
- else n = KEYMAX;
-
- for(i=0;i<n;i++) { /* PFキー登録文字退避 */
- regs.h.ah = 0x0f;
- regs.h.dh = 0x80;
- regs.h.dl = keysettbl[i*2];
- regs.x.di = (unsigned)&keygettbl[i][2];
- keygettbl[i][2] = 15;
- xint90x();
- keygettbl[i][0] = regs.h.al;
- keygettbl[i][1] = regs.h.cl;
- }
- for(i=0;i<n;i++) { /* PFキー文字登録 */
- pfkeyset[0] = 0xff;
- pfkeyset[1] = keysettbl[i*2+1];
- regs.x.ax = 0x0e00;
- regs.x.cx = 0x0002;
- regs.h.dh = 0x80;
- regs.h.dl = keysettbl[i*2];
- regs.x.di = (unsigned)pfkeyset;
- xint90x();
- }
- if(vrammode != 2) {
- for(i=0;i<KEY2MAX;i++) { /* 編集キー登録文字退避 */
- regs.h.ah = 0x0f;
- regs.h.dh = 0x00;
- regs.h.dl = keyset2tbl[i*2];
- regs.x.di = (unsigned)&keyget2tbl[i][2];
- keyget2tbl[i][2] = 7;
- xint90x();
- keyget2tbl[i][0] = regs.h.al;
- keyget2tbl[i][1] = regs.h.cl;
- }
- for(i=0;i<KEY2MAX;i++) { /* 編集キー文字登録 */
- regs.x.ax = 0x0e00;
- regs.x.cx = 0x0001;
- regs.h.dh = 0x00;
- regs.h.dl = keyset2tbl[i*2];
- regs.x.di = (unsigned)&keyset2tbl[i*2+1];
- xint90x();
- }
- }
- regs.h.ah = 0x05;
- regs.x.di = (unsigned)machineinfo;
- xint86x(0xaf);
- defline = 20;
- switch(vrammode) {
- case 3:
- case 0: dispmode = 0;
- break;
- default:
- if(machineinfo[3] & 2) dispmode = 1;
- else dispmode = 2;
- }
- printf("\033[=7l"); /* 最終桁でカーソル移動しない設定 */
- #endif
- #ifdef PC_98
- unsigned char far *nec_biosflag = (unsigned char far *)0x000501L;
-
- #ifdef PC88VA
- if (vrammode == 3 || (vrammode == 0 && Va_ChkVA())) {
- vrammode = 3;
- vramadr = 0xa000;
- vramatr = 0xa800;
- defline = 20;
- saveMseMode = Va_GetMseMode();
- Va_SetMseMode(VA_STD);
- dflt_atr = 0x70;
- atr = 0x70;
- Va_FuncKeySw(1);
- } else
- #endif
- if((vrammode == 1) || (!vrammode && (*nec_biosflag & 8))) {
- vramadr = 0xe000;
- vramatr = 0xe200;
- vrammode = 1;
- defline = 25;
- }
- else {
- vramadr = 0xa000;
- vramatr = 0xa200;
- vrammode = 0;
- defline = 20;
- }
- printf("\033[>1h"); /* PFキー文字表示無し設定 */
- #endif
- #ifdef PC_AT
- defline = 0;
- dispmode = vrammode;
- if(vrammode == J3100) dispmode = AT;
- if(dispmode == DOSV) {
- regs.h.ah = 0xfe; /* 疑似ビデオ・バッファ アドレス の取得 */
- xint86x(0x10);
- vramadr = sregs.es;
- }
- else vramadr = 0xb800;
- regs.h.ah = 0x0f;
- xint86(0x10);
- actpage = regs.h.bh;
- regs.h.ah = 0x03;
- xint86(0x10);
- cslmode = regs.x.cx;
- if(vrammode == J3100) { /* スクロールモード退避&高速スクロールセット */
- regs.x.ax = 0x8200;
- regs.h.bl = -1;
- xint86(0x10);
- sclmode = regs.h.al;
- regs.x.ax = 0x8200;
- regs.h.bl = 0;
- xint86(0x10);
- }
- #endif
- if(strlen(ESCin)) printf(ESCin); /* ESC0出力 */
- if(!mode) {
- regs.x.ax = 0x3300;
- xintdos();
- ctlcsave = regs.h.dl;
- savesignal = signal(SIGINT,(void (*)())sigint_ent);
- }
- deforutoiro();
- regs.x.ax = 0x3301;
- regs.h.dl = 0x00;
- xintdos();
- }
-
- void restorecon(int mode) /* 画面情報復帰 */
- {
- #ifdef FMR
- int i;
- int n;
- if(vrammode == 2) n = 10;
- else n = KEYMAX;
-
- for(i=0;i<n;i++) { /* PFキー文字復帰 */
- regs.h.ah = 0x0e;
- regs.h.al = keygettbl[i][0];
- regs.h.ch = 0x00;
- regs.h.cl = keygettbl[i][1];
- regs.h.dh = 0x80;
- regs.h.dl = keysettbl[i*2];
- regs.x.di = (unsigned)&keygettbl[i][3];
- xint90x();
- }
- if(vrammode != 2) {
- for(i=0;i<KEY2MAX;i++) { /* 編集キー文字復帰 */
- regs.h.ah = 0x0e;
- regs.h.al = keyget2tbl[i][0];
- regs.h.ch = 0x00;
- regs.h.cl = keyget2tbl[i][1];
- regs.h.dh = 0x00;
- regs.h.dl = keyset2tbl[i*2];
- regs.x.di = (unsigned)&keyget2tbl[i][3];
- xint90x();
- }
- }
- printf("\033[=7h"); /* 最終桁でカーソル移動する設定 */
- #endif
- #ifdef PC_98
- #ifdef PC88VA
- if (vrammode == 3) {
- Va_SetMseMode(saveMseMode);
- Va_FuncKeySw(0);
- }
- #else
- int i;
- if(!vrammode && line > 25) {
- loc(1,line);
- for(i=0;i<80;i++) print(" ");
- }
- #endif
- printf("\033[>1l"); /* PFキー文字表示有り設定 */
- #endif
- #ifdef PC_AT
- regs.h.ah = 0x01;
- regs.x.cx = cslmode;
- xint86(0x10);
- if(vrammode == J3100) { /* スクロールモード復元 */
- regs.x.ax = 0x8200;
- regs.h.bl = sclmode;
- xint86(0x10);
- }
- #endif
- if(strlen(ESCout)) printf(ESCout); /* ESC1出力 */
- if(!mode) {
- signal(SIGINT,savesignal);
- regs.h.dl = ctlcsave;
- }
- else regs.h.dl = 0x00;
- regs.x.ax = 0x3301;
- xintdos();
- }
-
- void cslon(void) /* カーソル表示 */
- {
- #ifdef FMR
- regs.h.ah = 0x0c;
- xint91();
- if(!regs.h.al)
- return;
- regs.x.ax = 0x0b00;
- xint91();
- #endif
- #ifdef PC_98
- regs.h.ah = 0x11;
- xint86(0x18);
- #endif
- #ifdef PC_AT
- regs.h.ah = 0x01;
- regs.x.cx = 0x0607;
- xint86(0x10);
- #endif
- }
-
- void csloff(void) /* カーソル非表示 */
- {
- #ifdef FMR
- regs.h.ah = 0x0c;
- xint91();
- if(regs.h.al == 1)
- return;
- regs.x.ax = 0x0b01;
- xint91();
- #endif
- #ifdef PC_98
- regs.h.ah = 0x12;
- xint86(0x18);
- #endif
- #ifdef PC_AT
- regs.h.ah = 0x01;
- regs.x.cx = cslmode | 0x2000;
- xint86(0x10);
- #endif
- }
-
- void chglowline(void) /* 20/25行画面設定 */
- {
- #ifdef FMR
- printf("\033[=3l");
- #endif
- #ifdef PC_98
- #ifdef PC88VA
- if(vrammode != 1) printf("\033[>3h");
- #else
- if(vrammode == 0) printf("\033[>3h");
- #endif
- else {
- regs.x.ax = 0x0a00;
- xint86(0x18);
- }
- #endif
- allclr();
- return;
- }
-
- void chghighline(void) /* 25/31行画面設定 */
- {
- #ifdef FMR
- printf("\033[=2l");
- #endif
- #ifdef PC_98
- #ifdef PC88VA
- if(vrammode != 1) printf("\033[>3l");
- #else
- if(vrammode == 0) printf("\033[>3l");
- #endif
- else {
- regs.x.ax = 0x0a10;
- xint86(0x18);
- }
- #endif
- return;
- }
-
- void clr(void) /* カーソル以下画面クリア */
- {
- #ifdef PC_AT
- if(dispmode == DOSV) printf("\033[K");
- else printf("\033[2K");
- #else
- printf("\033[2K");
- #endif
- }
-
- void clr1(char atr) /* 行クリア */
- {
- iro(atr);
- print(space);
- deforutoiro();
- }
-
- void clr2(void) /* カーソル以下画面クリア(VRAMモード=3専用) */
- {
- #ifdef FMR
- if(vrammode == 3) printf("\033[2K");
- #endif
- #ifdef PC_AT
- if(vrammode == J3100) printf("\033[2K");
- #endif
- return;
- }
-
- void allclr(void) /* 全画面クリア */
- {
- deforutoiro();
- #ifdef FMR
- regs.h.ah = 0x02;
- xint91();
- #else /* not FMR */
- printf("\033[2J");
- #endif
- csloff();
- }
-
- void setline(int l) /* 画面行数設定 */
- {
- #ifdef FMR
- regs.x.ax = 0x0401;
- xint90();
- #endif
- if(l && l == defline) chglowline();
- else chghighline();
- #ifdef FMR
- regs.x.ax = 0x0400;
- xint90();
- #endif
- csloff();
- }
-
- char atrt[4];
- static char save_color;
- void atrset(char color) /* 画面アトリビュート設定 */
- {
- #ifdef FMR
- char r;
-
- save_color = color;
- r = color & 0x38;
- if(r & 0x20) r |= 0x80;
- color &= 0x07;
- switch(dispmode) {
- case 0: atrt[0] = 0;
- atrt[1] = r;
- atrt[2] = color;
- atrt[3] = 0;
- regs.h.ah = 0x11;
- regs.x.di = (unsigned)atrt;
- xint91x();
- break;
- case 1: atr1 = (int)((r << 8) & 0x3f00) | color;
- if(r & 0x20) atr1 |= 0x08;
- break;
- case 2: atr1 = (int)(r & 0x38) | color;
- }
- #endif
- #ifdef PC_98
- save_color = color;
- #ifdef PC88VA
- if (vrammode == 3)
- atr = (color & 7) * 0x10;
- else
- #endif
- atr = ((color & 7) * 32)+1;
- if(color & 0x08) atr |= 0x04;
- if(color & 0x10) atr |= 0x02;
- if(color & 0x20) atr |= 0x08;
- #endif
- #ifdef PC_AT
- save_color = color;
- if(dispmode != DOSV) {
- atr = color & 7;
- switch(atr) {
- case 2: atr = 4;break;
- case 3: atr = 5;break;
- case 4: atr = 2;break;
- case 5: atr = 3;break;
- }
- if(color & 0x08) atr <<= 4;
- if(color & 0x20) atr |= 0x88;
- }
- else atr = color;
- #endif
- }
-
- void iro(char colorno) /* 画面色属性設定 */
- {
- atrset(irotbl[colorno]);
- }
-
- void deforutoiro(void) /* デフォルト色属性設定 */
- {
- iro(IETC);
- }
-
- static void vputc(unsigned c) /* 画面1文字表示 */
- {
- #ifdef FMR
- int far *ap;
- int far *atrp;
- char far *ap1;
-
- switch(dispmode) {
- case 0: regs.x.ax = 0x1300;
- regs.h.bh = 0x00;
- regs.h.bl = c;
- regs.h.dh = gyo;
- regs.h.dl = keta;
- int86(0x91,®s,®s);
- break;
- case 1: ap = (int far *)MK_FP(0xf800,vramoffset);
- atrp = (int far *)MK_FP(0xfa00,vramoffset);
- *ap = c;
- *atrp = (int)atr1;
- break;
- case 2: ap1 = (char far *)MK_FP(0xc800,vramoffset);
- *ap1 = c;
- *(ap1+1) = atr1;
- }
- keta++;
- vramoffset += 2;
- #endif
- #ifdef PC_98
- int far *ap;
- int far *atrp;
-
- ap = (int far *)MK_FP(vramadr,vramoffset);
- atrp = (int far *)MK_FP(vramatr,vramoffset);
- *ap = c;
- *atrp = (int)atr;
- if(!vrammode && vramoffset >= 0x1220) {
- ap = (int far *)MK_FP(vramadr,vramoffset+0x1f40-0x1220);
- atrp = (int far *)MK_FP(vramatr,vramoffset+0x1f40-0x1220);
- *ap = c;
- *atrp = (int)atr;
- }
- keta++;
- vramoffset += 2;
- #endif
- #ifdef PC_AT
- int far *ap;
-
- switch(dispmode) {
- case AT: regs.h.ah = 0x02;
- regs.h.bh = actpage;
- regs.h.dh = gyo-1;
- regs.h.dl = keta-1;
- xint86(0x10);
- regs.h.ah = 0x09;
- regs.h.al = c;
- regs.h.bh = actpage;
- regs.h.bl = atr;
- regs.x.cx = 1;
- xint86(0x10);
- break;
- case AX: ap = (int far *)MK_FP(vramadr,vramoffset);
- *ap = c | (atr * 0x100);
- break;
- case DOSV: ap = (int far *)MK_FP(vramadr,vramoffset);
- *ap = c | (atr * 0x100);
- break;
- }
- keta++;
- vramoffset += 2;
- #endif
- }
-
- /*
- static void vputw(unsigned w) * 画面2文字表示 *
- {
- #ifdef FMR
- char far *ap1;
- int a;
- char b,c;
-
- switch(dispmode) {
- case 0: regs.x.ax = 0x1300;
- regs.h.bh = 0x01;
- regs.h.bl = w/256;
- regs.h.dh = gyo;
- regs.h.dl = keta;
- int86(0x91,®s,®s);
- regs.x.ax = 0x1300;
- regs.h.bh = 0x03;
- regs.h.bl = w & 0xff;
- regs.h.dh = gyo;
- regs.h.dl = keta+1;
- int86(0x91,®s,®s);
- keta += 2;
- if(keta > 80) {
- keta = 1;
- gyo++;
- }
- break;
- case 1: a = w;
- vputc(a | 0x8000);
- vputc(a | 0x8080);
- break;
- case 2: b = w & 0xff;
- c = w / 256;
- ap1 = (char far *)MK_FP(0xc800,vramoffset);
- *(ap1+1) = (char)(atr1 | 0x40);
- *(ap1+3) = (char)(atr1 & 0xbf);
- ap1 = (char far *)MK_FP(0xca00,vramoffset);
- *ap1 = c;
- *(ap1+1) = b;
- *(ap1+2) = c;
- *(ap1+3) = b;
- keta += 2;
- if(keta > 80) {
- keta = 1;
- gyo++;
- }
- vramoffset += 4;
- }
- #endif
- #ifdef PC_98
- int a;
-
- a = (w & 0xff)*256 + w/256;
- a -= 0x20;
- vputc(a);
- a |= 0x8080;
- vputc(a);
- #endif
- #ifdef PC_AT
- vputc(w/256);
- vputc(w&0xff);
- #endif
- }
- */
-
- static char xbuf[81];
- void print(char *pt) /* 画面表示 */
- {
- int h,l;
- int k = 0;
- char scolor;
- #ifdef FMR
- char far *ap1;
- char *out,c;
- #endif
- #ifdef PC_AT
- char *out,c;
- struct REGPACK regp;
- long offset = vramoffset;
- #else
- int a;
- #endif
- #ifdef FMR
- if(vrammode == 3) {
- for(k=0,out = xbuf;c=*pt;pt++) {
- if(c == '\t') {
- if(bunmode && tabcrmode == 2) {
- *out++ = '・';
- keta++;
- for(;(keta-1)%(tabno);) {
- *out++ = '.';
- keta++;
- }
- }
- else {
- *out++ = ' ';
- keta++;
- for(;(keta-1)%(tabno);) {
- *out++ = ' ';
- keta++;
- }
- }
- continue;
- }
- if(c == '\n') {
- if(tabcrmode) k = 1;
- break;
- }
- if(iskanji(c) && iskanji2(*(pt+1))) {
- *out++ = c;
- *out++ = *(++pt);
- keta += 2;
- continue;
- }
- if(c < ' ' || c > '゚') c = ' ';
- *out++ = c;
- keta++;
- }
- *out = 0;
- regs.h.ah = 0x1e;
- regs.x.cx = strlen(xbuf);
- regs.x.di = (unsigned)xbuf;
- int86x(0x91,®s,®s,&sregs);
- if(k) {
- vputc(RTN_CODE);
- }
- return;
- }
- #endif
- #ifdef PC_AT
- if(vrammode == J3100) {
- h = keta;
- for(k=0,out = xbuf;c=*pt;pt++) {
- if(c == '\t') {
- if(bunmode && tabcrmode == 2) {
- *out++ = '・';
- keta++;
- for(;(keta-1)%(tabno);) {
- *out++ = '.';
- keta++;
- }
- }
- else {
- *out++ = ' ';
- keta++;
- for(;(keta-1)%(tabno);) {
- *out++ = ' ';
- keta++;
- }
- }
- continue;
- }
- if(c == '\n') {
- if(tabcrmode) k = 1;
- break;
- }
- if(iskanji(c) && iskanji2(*(pt+1))) {
- *out++ = c;
- *out++ = *(++pt);
- keta += 2;
- continue;
- }
- if(c < ' ' || c > '゚') c = ' ';
- *out++ = c;
- keta++;
- }
- *out = 0;
- regp.r_dx = (gyo-1)*256+(h-1);
- regp.r_ax = 0x1300;
- regp.r_bx = actpage*256+atr;
- regp.r_cx = strlen(xbuf);
- regp.r_bp = (unsigned)xbuf;
- regp.r_es = sregs.ds;
- intr(0x10,®p);
- if(k) {
- vputc(RTN_CODE);
- }
- return;
- }
- #endif
- scolor = save_color;
- for(;h=(int)*pt;pt++) {
- if(h == '\t') {
- if(bunmode && tabcrmode == 2) {
- iro(ITAB);
- vputc(TAB_CODE);
- k++;
- for(;(keta-1)%(tabno);) {
- vputc('.');
- k++;
- }
- atrset(scolor);
- }
- else {
- vputc(' ');
- k++;
- for(;(keta-1)%(tabno);) {
- vputc(' ');
- k++;
- }
- }
- continue;
- }
- if(h == '\n') {
- if(bunmode && tabcrmode) {
- iro(ICR);
- #ifdef PC_AT
- if(dispmode != AX) vputc(RTN_CODE);
- else vputc(RTNAX_CODE);
- #else
- vputc(RTN_CODE);
- #endif
- k++;
- atrset(scolor);
- }
- else {
- vputc(' ');
- k++;
- }
- for(;keta <= 80;) {
- vputc(' ');
- k++;
- }
- continue;
- }
- if(iskanji(h) && iskanji2(*(pt+1))) {
- l = (int)*(++pt);
- #ifndef PC_AT
- h -= (h <= 0x9f) ? 0x71 : 0xb1;
- h = (h << 1) + 1;
- if(l > 0x7f) l--;
- if(l >= 0x9e) {
- l -= 0x7d;
- h++;
- }
- else l -= 0x1f;
- #endif
- #ifdef FMR
- switch(dispmode) {
- case 0: regs.x.ax = 0x1300;
- regs.h.bh = 0x01;
- regs.h.bl = h;
- regs.h.dh = gyo;
- regs.h.dl = keta;
- int86(0x91,®s,®s);
- regs.x.ax = 0x1300;
- regs.h.bh = 0x03;
- regs.h.bl = l;
- regs.h.dh = gyo;
- regs.h.dl = keta+1;
- int86(0x91,®s,®s);
- keta += 2;
- break;
- case 1: a = (h*256 + l);
- vputc(a | 0x8000);
- vputc(a | 0x8080);
- break;
- case 2: ap1 = (char far *)MK_FP(0xc800,vramoffset);
- *(ap1+1) = (char)(atr1 | 0x40);
- *(ap1+3) = (char)(atr1 & 0xbf);
- ap1 = (char far *)MK_FP(0xca00,vramoffset);
- *ap1 = h;
- *(ap1+1) = l;
- *(ap1+2) = h;
- *(ap1+3) = l;
- keta += 2;
- vramoffset += 4;
- }
- #endif
- #ifdef PC_98
- a = (l)*256 + h;
- a -= 0x20;
- vputc(a);
- a |= 0x8080;
- vputc(a);
- #endif
- #ifdef PC_AT
- vputc(h);
- vputc(l);
- k += 2;
- #endif
- continue;
- }
- if(h < ' ' || h > '゚') h = ' ';
- vputc(h);
- k++;
- }
- #ifdef PC_AT
- if(dispmode == DOSV)
- dosv_disp(offset,k);
- #endif
- }
-
- int keycheck(void) /* キー入力チェック */
- {
- #ifdef FMR
- regs.h.ah = 0x07;
- xint90(); /* キー入力チェック */
- if(regs.h.dh == 0xff) {
- return(0);
- }
- #endif
- #ifdef PC_98
- regs.h.ah = 0x01;
- xint86(0x18); /* キー入力チェック */
- if(!regs.h.bh) {
- return(0);
- }
- #endif
- #ifdef PC_AT
- if(dispmode) regs.h.ah = 0x11;
- else regs.h.ah = 0x01;
- xint86(0x16); /* キー入力チェック */
- if(regs.x.flags & 0x40) {
- return(0);
- }
- #endif
- return(1);
- }
-
- void keyget(void) /* キー押下待ち */
- {
- regs.x.ax = 0x0cff;
- xintdos();
-
- #ifdef FMR
- regs.x.ax = 0x0900;
- xint90();
- #endif
- #ifdef PC_98
- regs.h.ah = 0x00;
- xint86(0x18);
- #endif
- #ifdef PC_AT
- regs.h.ah = 0x00;
- xint86(0x16);
- #endif
- regs.x.ax = 0x0cff;
- xintdos();
- }
-
- static void jikokusub(int mode)
- {
- char buf[12];
- struct tm *jtime;
-
- jtime = localtime(lsavetime);
- if(mode) {
- sprintf(buf,"%02d:%02d:%02d ",
- jtime->tm_hour,jtime->tm_min,jtime->tm_sec);
- }
- else {
- if(jtime->tm_hour < 12)
- sprintf(buf,"%02d:%02d:%02dAM",
- jtime->tm_hour,jtime->tm_min,jtime->tm_sec);
- else
- sprintf(buf,"%02d:%02d:%02dPM",
- jtime->tm_hour-12,jtime->tm_min,jtime->tm_sec);
- }
- print(buf);
- }
-
- static time_t sv_time[1];
- static void jikokudisp(int mode,int mode2)
- {
- time_t ltime[1];
- char a;
-
- time(ltime);
- if(mode) {
- if(lsavetime[0] == ltime[0]) return;
- }
- if((mode2 == 1) && ltime[0] >= sv_time[0]+waittimes) {
- hpread(titlecount,3);
- ttail = p_tail;
- sv_time[0] = ltime[0];
- }
- if(mode2 == 2) {
- #ifdef FMR
- regs.h.ah = 0x08;
- xint90();
- a = regs.h.al & 0x04;
- #endif
- #ifdef PC_98
- regs.h.ah = 0x02;
- xint86(0x18);
- a = regs.h.al & 0x01;
- #endif
- #ifdef PC_AT
- regs.h.ah = 0x02;
- xint86(0x16);
- a = regs.h.al & 0x03;
- #endif
- if((!a && (ltime[0] >= sv_time[0]+autodisptime))
- || (a && (ltime[0] >= sv_time[0]+autodisptime/5))) {
- autodispsw = 1;
- sv_time[0] = ltime[0];
- }
- }
- lsavetime[0] = ltime[0];
- loc(71,1);iro(IJIKOKU);
- switch(jikokumode) {
- case 0: if(!mode) iro(ITITLE); print(" "); break;
- case 1: jikokusub(1); break;
- default:jikokusub(0); break;
- }
- deforutoiro();
- }
-
- static void pfdispsub(char *buf,int i,int mode) /* PFキー表示サブ */
- {
- char *s;
- int k;
-
- #ifdef FMR
- if(mode != 3) k = keytbl[0x81 + mode*0x20 + i-1];
- else k = keytbl[0xf5 + i-1];
-
- s = " ";
- if(mode != 4) {
- switch(k) {
- case 0x81: s = " 終了";break;
- case 0x82: s = " トップ";break;
- case 0x83: s = " ラスト ";break;
- case 0x84: s = " ヘルプ";break;
- case 0x85: s = " 切出";break;
- case 0x86: s = " 削除";break;
- case 0x87: s = " コピー";break;
- case 0x88: s = " 検索";break;
- case 0x89: s = " ID";break;
- case 0x8a: if(nifmode == NFNORMAL) s = " コメント";
- else s = " ノーマル";
- break;
- case 0xa1: s = " DOS ";break;
- case 0xa2: if(tmode) s = "<ファイル";
- else s = " 前項";
- break;
- case 0xa3: if(tmode) s = "ファイル>";
- else s = " 次項";
- break;
- case 0xa4: if(tmode) s = "ファイル#";break;
- case 0xa5: s = " 取消";break;
- case 0xa6: s = "削キャン";break;
- case 0xa7: s = "タグ設";break;
- case 0xa8: s = "タグ←";break;
- case 0xa9: s = "タグ→";break;
- case 0xaa: s = " 発言";break;
- case 0xc1: if(tmode) s = " 書終";break;
- case 0xc2: s = " タイトル";break;
- case 0xc3: s = "<検索";break;
- case 0xc4: s = "検索>";break;
- case 0xc5: s = " 印刷";break;
- case 0xc6: if(tmode) s = "ログ大";break;
- case 0xc7: if(tmode) s = "ログ詳";break;
- case 0xc8: s = "20/25";break;
- case 0xc9: s = " ユーザ";break;
- case 0xca: s = "オート表";break;
- case 0xf5: if(tmode) s = "キャン終";break;
- case 0xf6: s = " +10 ";break;
- case 0xf7: s = " +20 ";break;
- case 0xf8: s = " +50 ";break;
- case 0xf9: s = "既セット";break;
- case 0xfa: s = "既キャン";break;
- case 0xfb: s = "JUMP@";break;
- case 0xfc: if(tmode) s = " TYPE";break;
- case 0xfd: s = "コメ+ID";break;
- case 0xfe: s = "発言2";break;
- }
- }
- if(i == 10) i = 0;
- sprintf(buf,"%d%s",i,s);
- #endif
- #ifdef PC_98
- if(mode != 3) k = keytbl[0x81 + mode*0x20 + i-1];
- else k = keytbl[0xf5 + i-1];
-
- s = " ";
- if(mode != 4) {
- switch(k) {
- case 0x81: s = "終了 ";break;
- case 0x82: s = "トップ ";break;
- case 0x83: s = " ラスト ";break;
- case 0x84: s = "ヘルプ ";break;
- case 0x85: s = "切出 ";break;
- case 0x86: s = "削除 ";break;
- case 0x87: s = "コピー ";break;
- case 0x88: s = "検索 ";break;
- case 0x89: s = "ID ";break;
- case 0x8a: if(nifmode == NFNORMAL) s = "コメント ";
- else s = "ノーマル ";
- break;
- case 0xa1: s = " DOS ";break;
- case 0xa2: if(tmode) s = "<ファイル";
- else s = "前項 ";
- break;
- case 0xa3: if(tmode) s = "ファイル>";
- else s = "次項 ";
- break;
- case 0xa4: if(tmode) s = "ファイル#";break;
- case 0xa5: s = " 取消";break;
- case 0xa6: s = "削キャン";break;
- case 0xa7: s = "タグ設";break;
- case 0xa8: s = "タグ←";break;
- case 0xa9: s = "タグ→";break;
- case 0xaa: s = "発言 ";break;
- case 0xc1: if(tmode) s = "書終 ";break;
- case 0xc2: s = "タイトル ";break;
- case 0xc3: s = "<検索";break;
- case 0xc4: s = "検索>";break;
- case 0xc5: s = "印刷 ";break;
- case 0xc6: if(tmode) s = "ログ大";break;
- case 0xc7: if(tmode) s = "ログ詳";break;
- #ifdef PC88VA
- case 0xc8: if(vrammode != 1) s = "20/25";
- #else
- case 0xc8: if(vrammode == 0) s = "20/25";
- #endif
- else s = "25/31";
- break;
- case 0xc9: s = "ユーザ ";break;
- case 0xca: s = "オート表";break;
- case 0xf5: if(tmode) s = "キャン終";break;
- case 0xf6: s = " +10 ";break;
- case 0xf7: s = " +20 ";break;
- case 0xf8: s = " +50 ";break;
- case 0xf9: s = "既セット";break;
- case 0xfa: s = "既キャン";break;
- case 0xfb: s = "JUMP@";break;
- case 0xfc: if(tmode) s = "TYPE ";break;
- case 0xfd: s = "コメ+ID";break;
- case 0xfe: s = "発言2";break;
- }
- }
- if(i == 10) i = 0;
- sprintf(buf,"%d %s",i,s);
- #endif
- #ifdef PC_AT
- if(mode != 3) k = keytbl[0x81 + mode*0x20 + i-1];
- else k = keytbl[0xf5 + i-1];
-
- s = " ";
- if(mode != 4) {
- switch(k) {
- case 0x81: s = " 終了";break;
- case 0x82: s = " トップ";break;
- case 0x83: s = " ラスト ";break;
- case 0x84: s = " ヘルプ";break;
- case 0x85: s = " 切出";break;
- case 0x86: s = " 削除";break;
- case 0x87: s = " コピー";break;
- case 0x88: s = " 検索";break;
- case 0x89: s = " ID";break;
- case 0x8a: if(nifmode == NFNORMAL) s = " コメント";
- else s = " ノーマル";
- break;
- case 0xa1: s = " DOS ";break;
- case 0xa2: if(tmode) s = "<ファイル";
- else s = " 前項";
- break;
- case 0xa3: if(tmode) s = "ファイル>";
- else s = " 次項";
- break;
- case 0xa4: if(tmode) s = "ファイル#";break;
- case 0xa5: s = " 取消";break;
- case 0xa6: s = "削キャン";break;
- case 0xa7: s = "タグ設";break;
- case 0xa8: s = "タグ←";break;
- case 0xa9: s = "タグ→";break;
- case 0xaa: s = " 発言";break;
- case 0xc1: if(tmode) s = " 書終";break;
- case 0xc2: s = " タイトル";break;
- case 0xc3: s = "<検索";break;
- case 0xc4: s = "検索>";break;
- case 0xc5: s = " 印刷";break;
- case 0xc6: if(tmode) s = "ログ大";break;
- case 0xc7: if(tmode) s = "ログ詳";break;
- case 0xc8: s = " ";break;
- case 0xc9: s = " ユーザ";break;
- case 0xca: s = "オート表";break;
- case 0xf5: if(tmode) s = "キャン終";break;
- case 0xf6: s = " +10 ";break;
- case 0xf7: s = " +20 ";break;
- case 0xf8: s = " +50 ";break;
- case 0xf9: s = "既セット";break;
- case 0xfa: s = "既キャン";break;
- case 0xfb: s = "JUMP@";break;
- case 0xfc: if(tmode) s = " TYPE";break;
- case 0xfd: s = "コメ+ID";break;
- case 0xfe: s = "発言2";break;
- }
- }
- if(i == 10) i = 0;
- if(i < 11)
- sprintf(buf,"%d%s",i,s);
- else
- sprintf(buf," %s",s);
- #endif
- }
-
- void pfdisp(int mode) /* PFキー表示 */
- {
- #ifdef FMR
- switch(mode) {
- case 0:
- pftbl[0] = FP_OFF(pfdata);
- pftbl[1] = FP_SEG(pfdata);
- pftbl[2] = FP_OFF(pfatr);
- pftbl[3] = FP_SEG(pfatr);
- break;
- case 1:
- pftbl[0] = FP_OFF(pfsdata);
- pftbl[1] = FP_SEG(pfsdata);
- pftbl[2] = FP_OFF(pfsatr);
- pftbl[3] = FP_SEG(pfsatr);
- break;
- case 2:
- pftbl[0] = FP_OFF(pfcdata);
- pftbl[1] = FP_SEG(pfcdata);
- pftbl[2] = FP_OFF(pfcatr);
- pftbl[3] = FP_SEG(pfcatr);
- break;
- case 3:
- pftbl[0] = FP_OFF(pfscdata);
- pftbl[1] = FP_SEG(pfscdata);
- pftbl[2] = FP_OFF(pfscatr);
- pftbl[3] = FP_SEG(pfscatr);
- break;
- case 4:
- pftbl[0] = FP_OFF(pfadata);
- pftbl[1] = FP_SEG(pfadata);
- pftbl[2] = FP_OFF(pfaatr);
- pftbl[3] = FP_SEG(pfaatr);
- break;
- }
- regs.x.ax = 0x1f01;
- regs.x.cx = 70;
- regs.h.dl = 1;
- regs.x.di = (unsigned)pftbl;
- xint91x();
- #endif
- #ifdef PC_98
- int i,col;
- char c,*b;
-
- col = irotbl[IPFKEY] & 0x07;
- switch(mode) {
- case 0: b=pfdata;
- break;
- case 1: b=pfsdata;
- break;
- case 2: b=pfcdata;
- break;
- case 3: b=pfscdata;
- break;
- case 4: b=pfadata;
- break;
- }
- loc(1,line);
- atrset(col);
- c = *(b+3);
- *(b+3) = 0;
- print(b);
- b += 3;
- *b = c;
- for (i = 0; i < 10; i++) {
- atrset(col);
- if(i == 5) {
- c = *(b+4);
- *(b+4) = 0;
- print(b);
- b += 4;
- }
- else {
- c = *(b+1);
- *(b+1) = 0;
- print(b);
- b++;
- }
- *b = c;
- atrset(0x08 | col);
- c = *(b+6);
- *(b+6) = 0;
- print(b);
- b += 6;
- *b = c;
- }
- deforutoiro();
- #endif
- #ifdef PC_AT
- int i,col;
- char c,*b;
-
- col = irotbl[IPFKEY];
- switch(mode) {
- case 0: b=pfdata;
- break;
- case 1: b=pfsdata;
- break;
- case 2: b=pfcdata;
- break;
- case 3: b=pfscdata;
- break;
- case 4: b=pfadata;
- break;
- }
- loc(1,line);
- atrset(col);
- c = *(b+2);
- *(b+2) = 0;
- print(b);
- b += 2;
- *b = c;
- for (i = 0; i < 12; i++) {
- atrset(col);
- if(i == 4 || i == 8) {
- c = *(b+3);
- *(b+3) = 0;
- print(b);
- b += 3;
- }
- else {
- c = *(b+1);
- *(b+1) = 0;
- print(b);
- b++;
- }
- *b = c;
- if(dispmode != DOSV)
- atrset(0x08 | col);
- else {
- c = (col & 15) * 16;
- atrset(c);
- }
- c = *(b+5);
- *(b+5) = 0;
- print(b);
- b += 5;
- *b = c;
- }
- deforutoiro();
- locate(1,1);
- #endif
- }
-
- static void pfsetsub(int mode) /* PFキー表示文字列作成サブ */
- {
- #ifdef FMR
- char buf[80],*b;
- struct ATR *at;
- int i,j,k;
- unsigned c;
-
- switch(mode) {
- case 0: b=pfdata;
- at=pfatr;
- break;
- case 1: b=pfsdata;
- at=pfsatr;
- break;
- case 2: b=pfcdata;
- at=pfcatr;
- break;
- case 3: b=pfscdata;
- at=pfscatr;
- break;
- case 4: b=pfadata;
- at=pfaatr;
- break;
- }
- for(i=0; i<70; i++){
- at[i].moji = 0x00;
- at[i].atr = 0;
- at[i].color = irotbl[IPFKEY] & 0x07;
- }
- switch(mode) {
- case 0:
- case 4: sprintf(b," "); break;
- case 1: sprintf(b,"S+"); break;
- case 3: sprintf(b,"SC"); break;
- default:sprintf(b,"C+");
- }
- for(j = 3,i = 1;i < 11;i++) {
- if(i == 6) {
- strcat(b," ");
- j += 2;
- }
- pfdispsub(buf,i,mode);
- for(k=1;k<=5;k++) {
- at[j+k-1].atr = 0x08;
- if(iskanji(buf[k])) {
- c = *(buf+k)*256 + *(buf+k+1);
- c = xjmstojis(c);
- *(buf+k) = (char)(c/256);
- *(buf+k+1) = (char)(c & 0xff);
- at[j+k-1].moji = 0x01;
- at[j+k].moji = 0x03;
- at[j+k].atr = 0x08;
- k++;
- }
- }
- strcat(b,buf);
- j += 6;
- }
- #endif
- #ifdef PC_98
- char buf[80],*b;
- int i;
-
- switch(mode) {
- case 0: b=pfdata;
- break;
- case 1: b=pfsdata;
- break;
- case 2: b=pfcdata;
- break;
- case 3: b=pfscdata;
- break;
- case 4: b=pfadata;
- break;
- }
- switch(mode) {
- case 0:
- case 4: sprintf(b," "); break;
- case 1: sprintf(b," S+"); break;
- case 3: sprintf(b,"SC+"); break;
- default:sprintf(b," C+");
- }
- for(i = 1;i < 11;i++) {
- if(i == 6) strcat(b," ");
- pfdispsub(buf,i,mode);
- strcat(b,buf);
- }
- #endif
- #ifdef PC_AT
- char buf[80],*b;
- int i;
-
- switch(mode) {
- case 0: b=pfdata;
- break;
- case 1: b=pfsdata;
- break;
- case 2: b=pfcdata;
- break;
- case 3: b=pfscdata;
- break;
- case 4: b=pfadata;
- break;
- }
- switch(mode) {
- case 0:
- case 4: sprintf(b," "); break;
- case 1: sprintf(b,"S+"); break;
- case 3: sprintf(b,"A+"); break;
- default:sprintf(b,"C+");
- }
- for(i = 1;i < 13;i++) {
- if(i == 5 || i == 9) strcat(b," ");
- pfdispsub(buf,i,mode);
- strcat(b,buf);
- }
- #endif
- }
-
- void pfset(void) /* PFキー表示文字列作成 */
- {
- pfsetsub(0);
- pfsetsub(1);
- pfsetsub(2);
- pfsetsub(3);
- pfsetsub(4);
- }
-
- void stsdisp(void) /* モード別状態表示 */
- {
- char buf[39];
-
- if(erron) return;
- memset(buf,0,39);
- switch(nifmode) {
- case NFID:
- iro(IID);
- sprintf(&buf[1],"ID:%s",nifid);
- break;
- case NFSEARCH:
- iro(IKEN);
- sprintf(&buf[1],"検索文字:%d件",kensakukensu);
- break;
- case NFAUTO1:
- iro(ISETUMEI);
- sprintf(&buf[1]," 自動表示 (改行キー:中止 空白キー:停止) ");
- break;
- case NFAUTO2:
- iro(ISETUMEI);
- sprintf(&buf[1]," 表示停止 (改行キー:中止 空白キー:再開) ");
- break;
- case NFCOMENT:
- case NFCOMENTID:
- if(gpo->mode == NFORUM || gpo->mode == NSEPA) {
- iro(ICMT);
- tbl_set(gpo);
- if(gpo->flag & FCYCLE) {
- if(!gpo->p->cid)
- sprintf(&buf[1]," コメント数:%d",
- gpo->p->cno);
- else
- sprintf(&buf[1]," %05uへのコメント コメント数:%d",
- gpo->p->cid,gpo->p->cno);
- }
- else {
- if(!gpo->p->cid)
- sprintf(&buf[1]," コメント数:%d",
- gpo->p->cno);
- else
- sprintf(&buf[1]," %03dへのコメント コメント数:%d",
- gpo->p->cid,gpo->p->cno);
- }
- break;
- }
- default:
- iro(ISETUMEI);
- sprintf(&buf[1]," 通常 (ESCキー:終了・復帰 空白キー:選択) ");
- break;
- }
- loc(1,line-1);
- switch(nextmode) {
- case 0: buf[0] = ' ';break;
- case 1: buf[0] = '-';break;
- default: buf[0] = '*';break;
- }
- strncat(buf,space,38-strlen(buf));
- print(buf);
- deforutoiro();
- }
-
- char keyget2(int mode) /* キー入力 */
- {
- int savea=0,a,b,c;
- int saveaa=0,saveaaa=0;
- while(1) {
- #ifdef FMR
- regs.h.ah = 0x08;
- xint90();
- a = (int)((regs.h.al >> 2) & 0x07);
- switch(a) {
- case 0:
- case 1: break;
- case 4: a = 2; break;
- default: a = 3; break;
- }
- #endif
- #ifdef PC_98
- regs.h.ah = 0x02;
- xint86(0x18);
- a = (int)(regs.h.al & 0x06);
- if(a != saveshift) {
- saveshift = a;
- loc(77,line);
- atrset(6);
- switch(a) {
- case 2: print("CAPS");break;
- case 4:
- case 6: print(" カナ ");break;
- default: print(" ");break;
- }
- deforutoiro();
- }
- a = (int)(regs.h.al & 0x11);
- switch(a) {
- case 0:
- case 1: break;
- case 0x10: a = 2; break;
- default: a = 3; break;
- }
- #endif
- #ifdef PC_AT
- regs.h.ah = 0x02;
- xint86(0x16);
- a = (int)(regs.h.al & 0x0f);
- switch(a) {
- case 0: break;
- case 1:
- case 2:
- case 3: a = 1; break;
- case 4: a = 2; break;
- default: a = 3; break;
- }
- #endif
- if(keyshiftmode) {
- if(a && a != saveaaa) {
- saveaa++;
- if(saveaa > 3) saveaa = 0;
- }
- saveaaa = a;
- a = saveaa;
- }
- if(savea != a) {
- if(nifmode == NFAUTO1) pfdisp(4);
- else pfdisp(a);
- savea = a;
- }
- jikokudisp(1,mode);
- if(mode == 2 && autodispsw) {
- autodispsw=0;
- return((char)0);
- }
- if(savea != 3) c = savea * 0x20;
- else c = 0;
- if(!keycheck()) {
- xint86(0x28); /* INT 28 CALL */
- continue;
- }
- sv_time[0] = lsavetime[0];
- #ifdef FMR
- regs.x.ax = 0x0900;
- xint90(); /* キー入力 */
- a = (int)regs.h.bh;
- b = (int)regs.h.dl;
- if(b == 0xff) {
- regs.x.ax = 0x0900;
- xint90(); /* キー入力 */
- b = (int)regs.h.dl;
- if(b >= '1' && b <= ':') {
- if(savea != 3) b = b + 0x81 - '1' + c;
- else b = b + 0xf5 - '1';
- break;
- }
- if(b >= ';' && b <= '?') {
- b = b + 0x81 - '1' + c;
- break;
- }
- if(b >= '@' && b <= 'D') {
- b = b + 0xe0 - '@';
- b += savea * 8;
- break;
- }
- if(b >= 'E' && b <= 'F') {
- b = b + 0x94 - 'E' + c;
- break;
- }
- continue;
- }
- if(b == 0x81) { /* オアシスのシフト+0 */
- b = 0xaa;
- break;
- }
- if(a >= 2 && a <= 11) { /* 数字キー→PFキー変換処理 */
- if(savea != 3) b = a + 0x81-2 + c;
- else b = a + 0xf5-2;
- break;
- }
- if(a == 0x72) { /* 取消キー */
- b = 0x9b + c;
- break;
- }
- if(a == 0x73) { /* 実行キー */
- b = 0x9a + c;
- break;
- }
- if(b == 0x0d){
- switch(savea) {
- case 1: b = 0xa0; break;
- case 2: b = 0xc0;
- }
- break;
- }
- if(a == 0x48) { /* 挿入キー */
- b = 0x98 + c;
- break;
- }
- if(a == 0x4b) { /* 削除キー */
- if(regs.h.dh == 0x80) b = 0x97; /* オアシス ? --> センタリングキー */
- else b = 0x99;
- b += c;
- break;
- }
- if(regs.h.dh == 0x80) { /* PFキー,編集キー */
- switch(a) {
- case 0x29: /* オアシス改頁キー */
- b = 0x9f;
- break;
- case 0x4e: /* オアシス文末キー */
- b = 0x96;
- break;
- case 0x6b:
- case 0x6c:
- case 0x6d: /* オアシス前頁,頁指定,次頁キー */
- b = a + 0x9c - 0x6b;
- break;
- case 0x6e: /* 前行キー */
- b = 0x94;
- break;
- case 0x70: /* 次行キー */
- b = 0x95;
- break;
- case 0x71: /* オアシス削除キー */
- b = 0x99;
- break;
- default: break; /* その他のキー */
- }
- b += c;
- break;
- }
- else if(b >= 128) continue;
- switch(b) {
- case 0x0b: /* HOMEキー */
- case 0x0c: b = 0x96;break; /* CLSキー */
- case 0x1c: b = 0x93;break; /* →キー */
- case 0x1d: b = 0x92;break; /* ←キー */
- case 0x1e: b = 0x90;break; /* ↑キー */
- case 0x1f: b = 0x91;break; /* ↓ー */
- default: break; /* その他のキー */
- }
- if(b >= 128) b += c;
- else {
- if(b >= '0' && b <= '9') {
- if(b == '0') b = 10;
- else b = b - '0';
- if(savea != 3) b = b + 0x80 + c;
- else b = b + 0xf4;
- break;
- }
- }
- break;
- #endif
- #ifdef PC_98
- regs.h.ah = 0x00;
- xint86(0x18); /* キー入力 */
- a = (int)regs.h.ah;
- b = (int)regs.h.al;
- if(a >= 1 && a <= 10) { /* 数字キー→PFキー変換処理 */
- if(savea != 3) b = a + 0x80 + c;
- else b = a + 0xf4;
- break;
- }
- if(b == 0x0d) {
- switch(savea) {
- case 1: b = 0xa0; break;
- case 2: b = 0xc0;
- }
- break;
- }
- if(b) {
- if(b >= 128) continue;
- if(b >= '0' && b <= '9') {
- if(b == '0') b = 10;
- else b = b - '0';
- if(savea != 3) b = b + 0x80 + c;
- else b = b + 0xf4;
- break;
- }
- /* b += c; */
- break;
- }
- if(a >= 0x62 && a <= 0x6b) { /* PF1~10キー */
- if(savea != 3) b = a + 0x81-0x62 + c;
- else b = a + 0xf5-0x62;
- break;
- }
- if(a >= 0x82 && a <= 0x8b) { /* シフト+PF1~10キー */
- if(savea != 3) b = a + 0xa1-0x82;
- else b = a + 0xf5-0x82;
- break;
- }
- if(a >= 0x92 && a <= 0x9b) { /* CTL+PF1~10キー */
- if(savea != 3) b = a + 0xc1-0x92;
- else b = a + 0xf5-0x92;
- break;
- }
- if(a >= 0x52 && a <= 0x56) { /* PF11~15キー */
- b = a + 0x8b-0x52 + c;
- break;
- }
- if(a >= 0xc2 && a <= 0xc6) { /* シフト+PF11~15キー */
- b = a + 0xab-0xc2;
- break;
- }
- if(a >= 0xd2 && a <= 0xd6) { /* CTL+PF11~15キー */
- b = a + 0xcb-0xd2;
- break;
- }
- if(a == 0xae) { /* CLRキー */
- b = 0xb6;
- break;
- }
- switch(a) { /* ROLLUP,ROLLDOWN,INS,DEL,↑,← */
- /* ,→,↓,HOME,HELPキー */
- case 0x36: b = 0x94; break;
- case 0x37: b = 0x95; break;
- case 0x38: b = 0x98; break;
- case 0x39: b = 0x99; break;
- case 0x3a: b = 0x90; break;
- case 0x3b: b = 0x92; break;
- case 0x3c: b = 0x93; break;
- case 0x3d: b = 0x91; break;
- case 0x3e: b = 0x96; break;
- case 0x3f: b = 0x97; break;
- }
- b += c;
- break;
- #endif
- #ifdef PC_AT
- if(dispmode) regs.h.ah = 0x10;
- else regs.h.ah = 0x00;
- xint86(0x16); /* キー入力 */
- a = (int)regs.h.ah;
- b = (int)regs.h.al;
- if(b == 0xe0) b = 0;
-
- if(b && b >= 128) continue;
- if(a >= 0x02 && a <= 0x0b) { /* 数字キー */
- if(savea != 3) b = a + 0x81 - 0x02 + c;
- else b = a + 0xf5-0x02;
- break;
- }
- if(a >= 0x3b && a <= 0x44) { /* F1~F10キー */
- if(savea != 3) b = a + 0x81 - 0x3b + c;
- else b = a + 0xf5-0x3b;
- break;
- }
- if(a >= 0x54 && a <= 0x5d) { /* シフト+F1~F10キー */
- if(savea != 3) b = a + 0xa1 - 0x54;
- else b = a + 0xf5-0x54;
- break;
- }
- if(a >= 0x5e && a <= 0x67) { /* CNTL+F1~F10キー */
- if(savea != 3) b = a + 0xc1 - 0x5E;
- else b = a + 0xf5-0x5e;
- break;
- }
- if(a >= 0x68 && a <= 0x71) { /* ALT+F1~F10キー */
- b = a + 0xf5 - 0x68;
- break;
- }
- switch(a) {
- case 0x48:
- case 0X8d: b = 0x90;break; /* ↑キー */
- case 0x4b:
- case 0x73: b = 0x92;break; /* ←キー */
- case 0x4d:
- case 0x74: b = 0x93;break; /* →キー */
- case 0x50:
- case 0x91: b = 0x91;break; /* ↓キー */
- case 0x1c: if(!c) b = 0x0d;
- else b = 0x80;break; /* ENTERキー */
- case 0x39: b = 0x20;break; /* 空白キー */
- case 0x49:
- case 0x84: b = 0x94;break; /* PAGEUPキー */
- case 0x51:
- case 0x76: b = 0x95;break; /* PAGEDWNキー */
- case 0x52:
- case 0x92: b = 0x98;break; /* INSキー */
- case 0x53:
- case 0x93: b = 0x99;break; /* DELキー */
- case 0x47:
- case 0x77: b = 0x96;break; /* HOMEキー */
- case 0x4f:
- case 0x75: b = 0x9a;break; /* ENDキー */
- case 0x85:
- case 0x87:
- case 0x89: b = 0x8b;break; /* PF11キー */
- case 0x86:
- case 0x88:
- case 0x8a: b = 0x8c;break; /* PF12キー */
- }
- if(b >= 128)
- b += c;
- break;
- #endif
- }
- if(savea) pfdisp(0);
- if(erron) {
- erron = 0;
- stsdisp(); /* エラー表示クリア */
- }
- regs.x.ax = 0x0cff;
- xintdos();
-
- return((char)b);
- }
-
- static int cnv_env(char *s)
- {
- int i,j;
- char buf[81],work[81],*o,*p;
-
- for(i=j=0;j < 81 && s[i];i++) {
- if(iskanji(s[i]) && iskanji2(s[i+1])) {
- buf[j++] = s[i++];
- buf[j++] = s[i];
- continue;
- }
- if(s[i] == '%') {
- o = &s[i+1];
- if(p = jstrchr(o,'%')) {
- *p++ = 0;
- strcpy(work,o);
- strupr(work);
- i += strlen(o) + 1;
- if(o = getenv(work)) {
- strcpy(&buf[j],o);
- j += strlen(o);
- }
- continue;
- }
- }
- buf[j++] = s[i];
- }
- buf[j] = 0;
- strcpy(s,buf);
- return(strlen(s));
- }
-
- void cgetsx(char *s,int mode) /* デフォルト付き文字列入力 */
- {
- int i;
- int a;
-
- regs.x.ax = 0x0cff;
- xintdos();
-
- cnv_env(&s[2]);
- s[1] = strlen(&s[2]);
- printf("%s",&s[2]);
- cslon();
- for(i = s[1];(a = (int)getch()) != '\r';) {
- #ifdef FMR
- if(a == 0x1e) a = 0x0b;
- else if(a == 0x1d) a = '\b';
- #endif
- #ifdef PC_AT
- if(a == 0) {
- a = (int)getch();
- if(a == 0x48) a = 0x0b;
- else if(a == 0x4b) a = '\b';
- else continue;
- }
- #endif
- if(a == 0xff) {
- getch();
- continue;
- }
- if(a == 0x18 || a == 0x0b) {
- if(!mode) {
- for(;i;i--) {
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- }
- else {
- if(!i) continue;
- if((nthctype(&s[2],i-1) == CT_ANK)
- && (s[2+i-1] == ':' || s[2+i-1] == '\\')) {
- i--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- for(;i;) {
- if(nthctype(&s[2],i-1) != CT_ANK) {
- i -= 2;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- else {
- if(s[2+i-1] != ':' && s[2+i-1] != '\\') {
- i--;
- putchar('\b');
- putchar(' ');
- putchar('\b');
- }
- else break;
- }
- }
- }
- continue;
- }
- if(a == '\r') break;
- if(a == '\b') {
- if(!i) continue;
- i--;
- if(nthctype(&s[2],i) == CT_KJ2) {
- i--;
- putchar((char)a);
- putchar(' ');
- putchar((char)a);
- }
- putchar((char)a);
- putchar(' ');
- putchar((char)a);
- continue;
- }
- if(a == '\t')
- a = ' ';
- if(a == 0x1b) {
- s[2] = (char)a;
- i = 1;
- break;
- }
- if(a < ' ' || a == 0x7f) continue;
- if(iskanji(a) && i >= s[0]-1) {
- getch();
- continue;
- }
- if(i >= s[0]) continue;
- putchar((char)a);
- s[2+i++] = (char)a;
- }
- csloff();
- s[2+i] = 0;
- s[1] = cnv_env(&s[2]);
- }
-
- int rtncut(char *a) /* 文字列から改行カット */
- {
- char c;
- int i,j;
-
- for(i = 0,j = 0;(c = a[i]);i++) {
- if(c == '\n' || c == '\r') {
- a[j] = 0;
- return(1);
- }
- if(c == '\b') {
- if(j) {
- j--;
- continue;
- }
- }
- if(c < ' ') a[j++] = ' ';
- else a[j++] = c;
- }
- a[j] = 0;
- return(0);
- }
-
- void rtncut2(char *a) /* 文字列からBSカット */
- {
- char c;
- int i,j;
-
- for(i = 0,j = 0;(c = a[i]);i++) {
- if(c == '\b') {
- if(j) {
- j--;
- continue;
- }
- }
- a[j++] = c;
- }
- a[j] = 0;
- }
-
- int yesnocheck(char *s) /* yes/noチェック */
- {
- char a,buf[81];
- int i;
-
- xlocate();
- sprintf(buf,"%s(Y/N) ",s);
- kprintf(buf);
- regs.x.ax = 0x0cff;
- xintdos();
- cslon();
- for(;a = getch();) {
- if(a == 0xff) {
- getch();
- continue;
- }
- if(a == 0x1b) {
- i = 0;
- break;
- }
- if(a == 'n' || a == 'N') {
- i = 0;
- break;
- }
- if(a == 'y' || a == 'Y') {
- i = 1;
- break;
- }
- if(a == '\r') {
- i = yesnomode;
- break;
- }
- }
- csloff();
- return(i);
- }
-
- static void errdisp(char *s,int mode) /* エラーメッセージ表示サブ */
- {
- char buf[81],c;
-
- if(erron == 2) {
- printf("%s\n",s);
- return;
- }
- if(erron) return;
- erron = 1;
- xlocate();
- xxstrncpy80(buf,s);
- if(mode) strncat80(buf," : 何かキーを押してください。");
- strncat80(buf,space);
- #ifndef PC_AT
- atrset(irotbl[IERROR] + 8);
- #else
- if(dispmode == DOSV) {
- c = (irotbl[IERROR] & 15) * 16;
- c += irotbl[IERROR] / 16;
- atrset(c);
- }
- else {
- atrset(irotbl[IERROR] + 8);
- }
- #endif
- print(buf);
- deforutoiro();
- if(mode) {
- keyget();
- erron = 0;
- }
- }
-
- void errdisp1(char *s) /* エラーメッセージ表示(1) */
- {
- errdisp(s,0);
- }
-
- void errdisp2(char *s) /* エラーメッセージ表示(2) */
- {
- errdisp(s,1);
- }
-
- void errdisp3(char *s) /* エラーメッセージ表示(3) メモリ不足時のみ */
- {
- foutmode |= F_MEMERR;
- errdisp(s,1);
- }
-
- void kprintf(char *buf) /* 確認メッセージ表示 */
- {
- erron = 0;
- iro(IKAKUNIN);
- print(buf);
- deforutoiro();
- locate(keta,gyo);
- }
-
- void eprintf(char *buf) /* エラーメッセージ表示 */
- {
- iro(IERROR);
- print(buf);
- deforutoiro();
- }
-
- void nstatus(int mode,PCELL far *po,int tno,int maxtno,int lno,int maxlno)
- { /* ライン数など状態表示 */
- char buf[81];
- PCELL far *l;
-
- tbl_set(po);
- if(fno != po->p->fno) {
- fno = po->p->fno;
- topdisp();
- }
- l = po->grp;
- if(savepno == -1 || savepno != l->count || savepflag != po->flag) {
- loc(1,2);
- memset(buf,0,81);
- sprintf(buf,"- ");
- tbl_set(l);
- _fstrncpy((char far *)&buf[2],l->p->title,78);
- if(strlen(buf) == 80 && nthctype(buf,79) == CT_KJ1) {
- buf[79] = 0;
- }
- switch(po->flag & ~(FTAG+FYOMI+FCYCLE)) {
- case FSENTAKU: iro(IRSENTAKU);
- buf[1] = '+';
- break;
- case FSAKUJYO: iro(IRSAKUJYO);
- buf[1] = 'd';
- break;
- case FSENTAKU+FSAKUJYO: iro(IRGATTAI);
- buf[1] = '*';
- break;
- default: if(po->flag & FYOMI) {
- iro(IRYOMI);
- buf[1] = '-';
- }
- else iro(IMODE);
- break;
- }
- strncat80(buf,space);
- print(buf);
- savepno = l->count;
- savepflag = po->flag;
- }
- gpo = po;
- if(erron) return;
- stsdisp();
- loc(39,line-1);iro(ILINE);
- if(tno == maxtno) tno--;
- sprintf(buf," %3d/%3dファイル %4d/%4dタイトル ",fno,maxfno,tno,maxtno-1);
- print(buf);
- loc(66,line-1);
- if(mode) {
- sprintf(buf,"%3d/%3dライン ",lno,maxlno);
- print(buf);
- loc(77,line-1);
- if(lno <= line-4) { iro(ILINE); print(" "); }
- else { iro(IUP);print("↑"); }
- loc(79,line-1);
- if(lno >= maxlno) { iro(ILINE); print(" "); }
- else { iro(IDOWN);print("↓"); }
- }
- else {
- print(" ----- ライン ");
- loc(77,line-1);
- if(lno <= line-4) { iro(ILINE); print(" "); }
- else { iro(IUP);print("↑"); }
- loc(79,line-1);
- if(lno >= maxtno) { iro(ILINE); print(" "); }
- else { iro(IDOWN);print("↓"); }
- }
- deforutoiro();
- }
-
- void xnstatus(void) /* 処理タイトル数表示 */
- {
- char buf[81];
-
- if(erron) return;
- loc(39+18,line-1);iro(ILINE);
- sprintf(buf,"%4d",p-1);
- print(buf);
- deforutoiro();
- }
-
- void topdisp(void) /* トップタイトル表示 */
- {
- char *a,buf[81];
-
- if(maxfno > 1)
- _fstrcpy((char far *)filename,file[fno-1]);
- if(!(a = jstrrchr(filename,'\\')) && !(a = jstrrchr(filename,':')))
- a = filename;
- else a++;
- if(strlen(a) > 12) a = "";
- loc(1,1);iro(IFILE);
- sprintf(buf,"%s",a);
- strcpy(gfilename,a);
- strncat(buf,space,12-strlen(buf));
- print(buf);
- loc(13,1);iro(INIFMODE);
- switch(nifmode) {
- case NFCOMENT: sprintf(buf," コメント ");break;
- case NFCOMENTID: sprintf(buf,"コメントID");break;
- case NFSEARCH: sprintf(buf," 検索 ");break;
- case NFID : sprintf(buf," ID ");break;
- default: sprintf(buf," ノーマル ");break;
- }
- print(buf);
- loc(19,1);iro(ITITLE);
- print(" NIFP(Ver 3.71) ログページャ by やなさん:GHC00073 ");
- jikokudisp(0,0);
- }
-
- int asctodec(char *buf) /* アスキー文字から数字へ変換 */
- {
- int i;
-
- i = (buf[0]-'0') * 100;
- i += (buf[1]-'0') * 10;
- i += (buf[2]-'0');
- if(buf[3] >= '0' && buf[3] <= '9') {
- i *= 100;
- i += (buf[3]-'0') * 10;
- i += (buf[4]-'0');
- }
- return(i);
- }
-
- char jiskatatbl[] = { 0x00,0xa7,0x00,0xb1,0x00,0xa8,0x00,0xb2,
- 0x00,0xa9,0x00,0xb3,0x00,0xaa,0x00,0xb4,
- 0x00,0xab,0x00,0xb5,0x00,0xb6,0xde,0xb6,
- 0x00,0xb7,0xde,0xb7,0x00,0xb8,0xde,0xb8,
- 0x00,0xb9,0xde,0xb9,0x00,0xba,0xde,0xba,
- 0x00,0xbb,0xde,0xbb,0x00,0xbc,0xde,0xbc,
- 0x00,0xbd,0xde,0xbd,0x00,0xbe,0xde,0xbe,
- 0x00,0xbf,0xde,0xbf,0x00,0xc0,0xde,0xc0,
- 0x00,0xc1,0xde,0xc1,0x00,0xaf,0x00,0xc2,
- 0xde,0xc2,0x00,0xc3,0xde,0xc3,0x00,0xc4,
- 0xde,0xc4,0x00,0xc5,0x00,0xc6,0x00,0xc7,
- 0x00,0xc8,0x00,0xc9,0x00,0xca,0xde,0xca,
- 0xdf,0xca,0x00,0xcb,0xde,0xcb,0xdf,0xcb,
- 0x00,0xcc,0xde,0xcc,0xdf,0xcc,0x00,0xcd,
- 0xde,0xcd,0xdf,0xcd,0x00,0xce,0xde,0xce,
- 0xdf,0xce,0x00,0xcf,0x00,0xd0,0x00,0x00,
- 0x00,0xd1,0x00,0xd2,0x00,0xd3,0x00,0xac,
- 0x00,0xd4,0x00,0xad,0x00,0xd5,0x00,0xae,
- 0x00,0xd6,0x00,0xd7,0x00,0xd8,0x00,0xd9,
- 0x00,0xda,0x00,0xdb,0x00,0x00,0x00,0xdc,
- 0x00,0x00,0x00,0x00,0x00,0xa6,0x00,0xdd,
- 0xde,0xb3,0x00,0x00,0x00,0x00 };
- static unsigned cnvkata1(unsigned w)
- {
- if(w == 0x815b) return(0xb0);
- w -= 0x8340;
- w *= 2;
- if(jiskatatbl[w])
- return(jiskatatbl[w+1]*256 | jiskatatbl[w]);
- return((unsigned)jiskatatbl[w+1]);
- }
-
- char asckatatbl[] = { 0x92,0x40,0x42,0x44,0x46,0x48,0x83,0x85,
- 0x87,0x62,0x00,0x41,0x43,0x45,0x47,0x49,
- 0x4a,0x4c,0x4e,0x50,0x52,0x54,0x56,0x58,
- 0x5a,0x5c,0x5e,0x60,0x63,0x65,0x67,0x69,
- 0x6a,0x6b,0x6c,0x6d,0x6e,0x71,0x74,0x77,
- 0x7a,0x7d,0x7e,0x80,0x81,0x82,0x84,0x86,
- 0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8f,0x93 };
- static unsigned cnvkata2(unsigned w,char c)
- {
- unsigned d;
-
- if(w == 0xb0) return(0x815b);
- d = (unsigned)asckatatbl[w - 0xa6];
- if(c == '゙') d++;
- else if(c == '゚') d += 2;
- return(0x8300 | d);
- }
-
- int rtnk=0;
- char *substrstr(char *b1,char *b2) /* 文字列検索 */
- {
- char c;
- unsigned w,x,y;
- int i,j,k,l1,l2;
-
- l2 = strlen(b2);
- l1 = strlen(b1);
- if(l1 < l2) return((char *)NULL);
- l1 -= l2;
- for(i = 0;i <= l1;i++) {
- for(k = i,j = 0;j < l2;j++,k++) {
- x = (unsigned)(b1[k]*256 + b1[k+1]);
- if(iskanji(b2[j])) { /* 全角? */
- w = (unsigned)(b2[j]*256 + b2[j+1]);
- j++;
- y = w;
- if(jishira(w)) { /* ひらがな? */
- y = jtokata(w);
- goto chkxx;
- }
- if(jiskata(w)) { /* カタカナ? */
- y = jtohira(w);
- goto chkxx;
- }
- if(jisupper(w)) { /* 英大文字? */
- y = jtolower(w);
- goto chkxx;
- }
- if(jislower(w)) { /* 英小文字? */
- y = jtoupper(w);
- }
- chkxx:
- if(x == w || x == y) {
- k++;
- continue;
- }
- if(w >= 0x839e) break;
- if(jiskata(w)) {
- w=cnvkata1(w);
- y = w;
- }
- else if(jiskata(y)) {
- w=cnvkata1(y);
- y = w;
- }
- else {
- w=zentohan(w);
- y = zentohan(y);
- }
- if(w >= 256) {
- if(x == w) {
- k++;
- continue;
- }
- }
- else
- if(b1[k] == (char)w || b1[k] == (char)y)
- continue;
- }
- else {
- w = (unsigned)b2[j];
- y = w;
- if(w >= 'A' && w <= 'Z') y = (w + 'a' - 'A');
- else if(w >= 'a' && w <= 'z') y = (w - 'a' + 'A');
- if(b1[k] == w || b1[k] == y) continue;
- if(iskmoji(w)) {
- if(b2[j+1] == '゚') c = '゚';
- else if(b2[j+1] == '゙') c = '゙';
- else c = 0;
- y = cnvkata2(w,c);
- w = jtohira(y);
- if(c) j++;
- }
- else {
- w = hantozen(w);
- y = hantozen(y);
- }
- if(x == y || x == w) {
- k++;
- continue;
- }
- }
- break;
- }
- if(j >= l2) {
- rtnk = k-i;
- return((char *)&b1[i]);
- }
- if(iskanji(b1[i])) i++;
- }
- return((char *)NULL);
- }
-
- void xxfseek(PCELL far *pt, long l)
- {
- tbl_set(pt);
- if(cfno != pt->p->fno) {
- xfclose();
- if(maxfno > 1) _fstrcpy((char far *)filename,file[pt->p->fno-1]);
- xfopen(filename);
- cfno = pt->p->fno;
- }
- xfseek(l);
- }
-
- FILE *xxfopen(char *path,char *mode)
- {
- FILE *fd1;
- char a[129],*b,c;
- struct stat sbuf;
-
- xxstrncpy(a,path,128);
- b = a;
- if(isalpha(b[0]) && b[1] == ':')
- b += 2;
- if(b[0] == '\\')
- b++;
- while(1) {
- for(;*b && *b != '\\'; b++)
- if(iskanji(b[0]) && iskanji2(b[1]))
- b++;
- if(!*b) goto xfopen1;
- c = *b;
- *b = 0;
- if(!stat(a,&sbuf)) {
- if(!(sbuf.st_mode & S_IFDIR))
- goto xfopen2;
- }
- else {
- if(mkdir(a))
- goto xfopen2;
- }
- *b++ = c;
- }
- xfopen1:
- if(!(fd1 = fopen(path,mode))) {
- xfopen2:
- sprintf(a,"%sファイルのオープンに失敗",path);
- errdisp2(a);
- return((FILE *)0);
- }
- return(fd1);
- }
-
- #define MAXBUF 8192
- static int fh;
- static long fdsize=0;
- static long fpoint=0;
- static long toppoint=0;
- static long tailpoint=0;
- static long cpoint=0;
- static char fbuffer[MAXBUF];
- FILE *xfopen(char *filename) {
-
- if(fd = fopen(filename,"rb")) {
- fh = fileno(fd);
- fdsize = filelength(fh);
- if(!fseek(fd,-1,SEEK_END))
- if(fgetc(fd) == 0x1a) fdsize--;
- fseek(fd,0,SEEK_SET);
- fpoint = 0;
- tailpoint = 0;
- }
- return(fd);
- }
-
- int xfclose(void) {
- return(fclose(fd));
- }
-
- int xfseek(long offset) {
- long x;
-
- x = fpoint;
- fpoint = offset;
- cpoint = fpoint % MAXBUF;
- return((int)x);
- }
-
- long xftell(void) {
- return(fpoint);
- }
-
- int xfgetc(void) {
- if(fpoint < toppoint || fpoint >= tailpoint || !tailpoint) {
- toppoint = fpoint / MAXBUF;
- cpoint = fpoint % MAXBUF;
- toppoint *= MAXBUF;
- lseek(fh,toppoint,0);
- tailpoint = read(fh,fbuffer,MAXBUF);
- if(tailpoint <= 0) fpoint = fdsize;
- else tailpoint += toppoint;
- }
- fpoint++;
- return((int)fbuffer[cpoint++]);
- }
-
- int xfeof(void) {
- if(fdsize <= fpoint) return(1);
- return(0);
- }
-
- char *xfgets(char *s, int n) {
- char *a;
- int c;
-
- if(fdsize <= fpoint) return((char *)0);
- a = s;
- for(; n-1;) {
- if(fpoint < toppoint || fpoint >= tailpoint || !tailpoint) {
- toppoint = fpoint / MAXBUF;
- cpoint = fpoint % MAXBUF;
- toppoint *= MAXBUF;
- lseek(fh,toppoint,0);
- tailpoint = read(fh,fbuffer,MAXBUF);
- if(tailpoint <= 0) fpoint = fdsize;
- else tailpoint += toppoint;
- }
- if(fdsize <= fpoint) {
- if(a == s) return((char *)0);
- break;
- }
- c = (int)fbuffer[cpoint++];
- fpoint++;
- if(c == 0x00) {
- foutmode |= F_UPDATE;
- continue;
- }
- if(c == 0x1a) {
- if(fdsize > fpoint)
- foutmode |= F_UPDATE;
- continue;
- }
- if(c == 0x0d) continue;
- *a++ = (char)c;
- n--;
- if(c == 0x0a)
- break;
- }
- *a = 0;
- return(s);
- }
-
- void xxstrncpy(char *s,char *d,int c)
- {
- memset(s,0,c+1);
- strncpy(s,d,c);
- }
-
- void xxstrncpy80(char *s,char *d)
- {
- xxstrncpy(s,d,80);
- }
-
- void xxstrncpy50(char *s,char *d)
- {
- xxstrncpy(s,d,50);
- }
-
- int xstrncmp(char *s,char *d)
- {
- /* return(strncmp(s,d,strlen(d))); */
- while(*s == *d) {
- if(!*d) return(0);
- s++;
- d++;
- if(!*d) return(0);
- }
- return(1);
- }
-
- int xstrcmp(char *s,char *d)
- {
- while(*s == *d) {
- if(!*d) return(0);
- s++;
- d++;
- }
- return(1);
- }
-
- void strncat80(char *msg,char *buf)
- {
- strncat(msg,buf,80-strlen(msg));
- }
-
- #ifdef FMR
- static char *pfkeytbl[265] = {
- "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
- "BS", "TAB", "^J", "^K", "^L", "リターン", "^N", "^O",
- "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
- "^X", "^Y", "^Z", "ESC", "^\\", "^]", "^^", "^_",
- "空白", "!", """", "#", "$", "%", "&", "'",
- "(", ")", "*", "+", ",", "-", ".", "/",
- "0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", ":", ";", "<", "=", ">", "?",
- "@", "A", "B", "C", "D", "E", "F", "G",
- "H", "I", "J", "K", "L", "M", "N", "O",
- "P", "Q", "R", "S", "T", "U", "V", "W",
- "X", "Y", "Z", "[", "\\", "]", "^", "~",
- "`", "a", "b", "c", "d", "e", "f", "g",
- "h", "i", "j", "k", "l", "m", "n", "o",
- "p", "q", "r", "s", "t", "u", "v", "w",
- "x", "y", "z", "{", "|", "}", "0x7E", "",
- "", "PF1", "PF2", "PF3", "PF4", "PF5", "PF6", "PF7",
- "PF8", "PF9", "PF10", "PF11", "PF12", "PF13", "PF14", "PF15",
- "↑", "↓", "←", "→", "前行", "次行", "HOME", "センタリング",
- "挿入", "削除", "実行", "取消", "前頁", "頁指定","次頁", "改頁",
- "S+リターン","S+PF1", "S+PF2", "S+PF3", "S+PF4", "S+PF5", "S+PF6", "S+PF7",
- "S+PF8", "S+PF9", "S+PF10","S+PF11","S+PF12","S+PF13","S+PF14", "S+PF15",
- "S+↑", "S+↓", "S+←", "S+→", "S+前行","S+次行","CLS", "S+センタリング",
- "S+挿入","S+削除","S+実行","S+取消","S+前頁","S+頁指定","S+次頁","S+改頁",
- "C+リターン","C+PF1", "C+PF2", "C+PF3", "C+PF4", "C+PF5", "C+PF6", "C+PF7",
- "C+PF8", "C+PF9", "C+PF10","C+PF11","C+PF12","C+PF13","C+PF14", "C+PF15",
- "C+↑", "C+↓", "C+←", "C+→", "C+前行","C+次行","C+HOME","C+センタリング",
- "C+挿入","C+削除","C+実行","C+取消","C+前頁","C+頁指定","C+次頁","C+改頁",
- "PF16", "PF17", "PF18", "PF19", "PF20", "", "", "",
- "S+PF16","S+PF17","S+PF18","S+PF19","S+PF20","", "", "",
- "C+PF16","C+PF17","C+PF18","C+PF19","C+PF20","SC+PF1","SC+PF2", "SC+PF3",
- "SC+PF4","SC+PF5","SC+PF6","SC+PF7","SC+PF8","SC+PF9","SC+PF10",""
- };
- #endif
- #ifdef PC_98
- static char *pfkeytbl[265] = {
- "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
- "BS", "TAB", "^J", "^K", "^L", "リターン", "^N", "^O",
- "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
- "^X", "^Y", "^Z", "ESC", "^\\", "^]", "^^", "^_",
- "空白", "!", """", "#", "$", "%", "&", "'",
- "(", ")", "*", "+", ",", "-", ".", "/",
- "0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", ":", ";", "<", "=", ">", "?",
- "@", "A", "B", "C", "D", "E", "F", "G",
- "H", "I", "J", "K", "L", "M", "N", "O",
- "P", "Q", "R", "S", "T", "U", "V", "W",
- "X", "Y", "Z", "[", "\\", "]", "^", "~",
- "`", "a", "b", "c", "d", "e", "f", "g",
- "h", "i", "j", "k", "l", "m", "n", "o",
- "p", "q", "r", "s", "t", "u", "v", "w",
- "x", "y", "z", "{", "|", "}", "0x7E", "",
- "", "f・1", "f・2", "f・3", "f・4", "f・5", "f・6", "f・7",
- "f・8", "f・9", "f・10", "vf・1", "vf・2", "vf・3", "vf・4", "vf・5",
- "↑", "↓", "←", "→", "ROLLUP","ROLLDOWN","HOME", "HELP",
- "INS", "DEL", "", "", "", "", "", "",
- "S+リターン","S+f・1", "S+f・2", "S+f・3", "S+f・4", "S+f・5", "S+f・6", "S+f・7",
- "S+f・8", "S+f・9", "S+f・10","S+vf・1","S+vf・2","S+vf・3","S+vf・4", "S+vf・5",
- "S+↑", "S+↓", "S+←", "S+→", "S+ROLLUP","S+ROLLDOWN","CLS","S+HELP",
- "S+INS", "S+DEL", "", "", "", "", "", "",
- "C+リターン","C+f・1", "C+f・2", "C+f・3", "C+f・4", "C+f・5", "C+f・6", "C+f・7",
- "C+f・8", "C+f・9", "C+f・10","C+vf・1","C+vf・2","C+vf・3","C+vf・4", "C+vf・5",
- "C+↑", "C+↓", "C+←","C+→","C+ROOLUP","C+ROLLDOWN","C+HOME","C+HELP",
- "C+INS", "C+DEL", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "", "", "",
- "", "", "", "", "", "SC+f・1","SC+f・2", "SC+f・3",
- "SC+f・4","SC+f・5","SC+f・6","SC+f・7","SC+f・8","SC+f・9","SC+f・10",""
- };
- #endif
- #ifdef PC_AT
- static char *pfkeytbl[265] = {
- "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G",
- "BS", "TAB", "^J", "^K", "^L", "リターン", "^N", "^O",
- "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W",
- "^X", "^Y", "^Z", "ESC", "^\\", "^]", "^^", "^_",
- "空白", "!", """", "#", "$", "%", "&", "'",
- "(", ")", "*", "+", ",", "-", ".", "/",
- "0", "1", "2", "3", "4", "5", "6", "7",
- "8", "9", ":", ";", "<", "=", ">", "?",
- "@", "A", "B", "C", "D", "E", "F", "G",
- "H", "I", "J", "K", "L", "M", "N", "O",
- "P", "Q", "R", "S", "T", "U", "V", "W",
- "X", "Y", "Z", "[", "\\", "]", "^", "~",
- "`", "a", "b", "c", "d", "e", "f", "g",
- "h", "i", "j", "k", "l", "m", "n", "o",
- "p", "q", "r", "s", "t", "u", "v", "w",
- "x", "y", "z", "{", "|", "}", "0x7E", "",
- "", "F1", "F2", "F3", "F4", "F5", "F6", "F7",
- "F8", "F9", "F10", "F11", "F12", "F13", "F14", "F15",
- "↑", "↓", "←", "→", "PgUp", "PgDn", "Home", "",
- "Ins", "Del", "End", "", "", "", "", "",
- "S+リターン","S+F1", "S+F2", "S+F3", "S+F4", "S+F5", "S+F6", "S+F7",
- "S+F8", "S+F9", "S+F10", "S+F11", "S+F12", "S+F13", "S+F14", "S+F15",
- "S+↑", "S+↓", "S+←", "S+→", "S+PgUp","S+PgDn","S+Home", "",
- "S+Ins", "S+Del", "S+End", "", "", "", "", "",
- "C+リターン","C+F1", "C+F2", "C+F3", "C+F4", "C+F5", "C+F6", "C+F7",
- "C+F8", "C+F9", "C+F10", "C+F11", "C+F12", "C+F13", "C+F14", "C+F15",
- "C+↑", "C+↓", "C+←", "C+→", "C+PgUp","C+PgDn","C+Home", "",
- "C+Ins", "C+Del", "C+End", "", "", "", "", "",
- "F16", "F17", "F18", "F19", "F20", "", "", "",
- "S+F16", "S+F17", "S+F18", "S+F19", "S+F20", "", "", "",
- "C+F16", "C+F17", "C+F18", "C+F19", "C+F20", "A+F1", "A+F2", "A+F3",
- "A+F4", "A+F5", "A+F6", "A+F7", "A+F8", "A+F9", "A+F10",""
- };
- #endif
-
- struct helptbl {
- char code;
- char *string;
- };
-
- #ifndef PC_AT
- #define HELP1NO 42
- #else
- #define HELP1NO 41
- #endif
- static struct helptbl help1tbl[HELP1NO] = {
- 0x90," ↑ …行スクロール(前行)",
- 0x91," ↓ …行スクロール(次行)",
- 0x92," ← …頁スクロール(前画面)",
- 0x93," → …頁スクロール(次画面)",
- 0xff," 選択 …内容の選択と取消し",
- 0x0d," リターン…タイトル一覧表示に戻る",
- 0x1b," ESC …タイトル一覧表示に戻る",
- 0x81,"[ 終了]…タイトル一覧表示に戻る",
- 0x82,"[ トップ]…先頭頁に移動",
- 0x83,"[ ラスト ]…最終頁に移動",
- 0x84,"[ヘルプ ] …ヘルプ呼び出し",
- 0x85,"[ 切出]…選択内容のファイル出力と削除指定",
- 0x86,"[ 削除]…選択内容の削除指定",
- 0x87,"[ コピー]…選択内容のファイル出力",
- 0x88,"[ 検索]…指定単語での検索して個数通知",
- 0x89,"[ ID]…IDによる絞り込み",
- 0x8a,"[ コメント]…会議室等のコメントツリー絞り込み",
- 0x8a,"[ ノーマル]…検索/コメント/ID/コメント+IDからノーマルへ",
- 0xa1,"[ DOS ]…MS-DOSコマンドの呼び出し",
- 0xa2,"[ 前項]…前の内容に移動",
- 0xa3,"[ 次項]…次の内容に移動",
- 0xa5,"[ 取消]…選択した全てを取消し",
- 0xa6,"[削キャン]…削除指定を取消し",
- 0xa7,"[タグ設]…タグ設定内容にする",
- 0xa8,"[タグ←]…前のタグ設定内容に移動",
- 0xa9,"[タグ→]…次のタグ設定内容に移動",
- 0xaa,"[ 発言]…内容をファイル出力してエディタ起動(1)",
- 0xc2,"[ タイトル]…タイトル一覧をファイル出力",
- 0xc3,"[<検索]…前タイトルと内容を検索して移動",
- 0xc4,"[検索>]…後タイトルと内容を検索して移動",
- 0xc5,"[ 印刷]…選択内容をファイル出力して印刷依頼",
- #ifndef PC_AT
- 0xc8,"[20/25]…画面の20/25行切換",
- #endif
- 0xc9,"[ ユーザ]…利用者コマンドの実行",
- 0xca,"[オート表]…自動表示",
- 0xf6,"[ +10 ]…10タイトル先の内容に移動",
- 0xf7,"[ +20 ]…20タイトル先の内容に移動",
- 0xf8,"[ +50 ]…50タイトル先の内容に移動",
- 0xf9,"[既セット]…この内容までを既読状態に設定",
- 0xfa,"[既キャン]…この内容以降を既読状態取消し",
- 0xfb,"[JUMP@]…ジャンプモードの切替",
- 0xfd,"[コメ+ID]…コメントツリーとタイトルのIDで絞り込み",
- 0xfe,"[発言2]…内容をファイル出力してエディタ起動(2)"
- };
-
- #ifndef PC_AT
- #define HELP2NO 48
- #else
- #define HELP2NO 47
- #endif
- static struct helptbl help2tbl[HELP2NO] = {
- 0x90," ↑ …行スクロール(前行)",
- 0x91," ↓ …行スクロール(次行)",
- 0x92," ← …頁スクロール(前画面)",
- 0x93," → …頁スクロール(次画面)",
- 0xff," 選択 …タイトル内容の選択と取消し",
- 0x0d," リターン…内容を表示",
- 0x1b," ESC …ノーマルモードへの復帰,NIFPを終了",
- 0x81,"[ 終了]…NIFPを終了",
- 0x82,"[ トップ]…先頭タイトルに移動",
- 0x83,"[ ラスト ]…最終タイトルに移動",
- 0x84,"[ヘルプ ] …ヘルプ呼び出し",
- 0x85,"[ 切出]…選択内容のファイル出力と削除指定",
- 0x86,"[ 削除]…選択内容の削除指定",
- 0x87,"[ コピー]…選択内容のファイル出力",
- 0x88,"[ 検索]…指定単語での検索絞り込み",
- 0x89,"[ ID]…IDによる絞り込み",
- 0x8a,"[ コメント]…会議室等のコメントツリー絞り込み",
- 0x8a,"[ ノーマル]…検索/コメント/ID/コメント+IDからノーマルへ",
- 0xa1,"[ DOS ]…MS-DOSコマンドの呼び出し",
- 0xa2,"[<ファイル]…前のログファイルに移動",
- 0xa3,"[ファイル>]…次のログファイルに移動",
- 0xa4,"[ファイル#]…指定のログファイルに移動",
- 0xa5,"[ 取消]…選択した全てを取消し",
- 0xa6,"[削キャン]…削除指定を取消し",
- 0xa7,"[タグ設]…タグ設定タイトルにする",
- 0xa8,"[タグ←]…前のタグ設定タイトルに移動",
- 0xa9,"[タグ→]…次のタグ設定タイトルに移動",
- 0xaa,"[ 発言]…内容をファイル出力してエディタ起動(1)",
- 0xc1,"[ 書終]…強制的にログファイルを書き込み終了",
- 0xc2,"[ タイトル]…タイトル一覧をファイル出力",
- 0xc3,"[<検索]…前のタイトルを検索して移動",
- 0xc4,"[検索>]…後のタイトルを検索して移動",
- 0xc5,"[ 印刷]…選択内容をファイル出力して印刷依頼",
- 0xc6,"[ログ大]…ログ整理(大分類)",
- 0xc7,"[ログ詳]…ログ整理(詳細分類)",
- #ifndef PC_AT
- 0xc8,"[20/25]…画面の20/25行切換",
- #endif
- 0xc9,"[ ユーザ]…利用者コマンドの実行",
- 0xca,"[オート表]…自動表示",
- 0xf5,"[キャン終]…未読情報を出力せずに終了",
- 0xf6,"[ +10 ]…10タイトル先のタイトルに移動",
- 0xf7,"[ +20 ]…20タイトル先のタイトルに移動",
- 0xf8,"[ +50 ]…50タイトル先のタイトルに移動",
- 0xf9,"[既セット]…このタイトルまでを既読状態に設定",
- 0xfa,"[既キャン]…このタイトル以降を既読状態取消し",
- 0xfb,"[JUMP@]…ジャンプモードの切替",
- 0xfc,"[ TYPE]…内容(ESCシーケンス付も可)をTYPE表示",
- 0xfd,"[コメ+ID]…コメントツリーとタイトルのIDで絞り込み",
- 0xfe,"[発言2]…内容をファイル出力してエディタ起動(2)"
- };
-
- void help(int mode) /* ヘルプ */
- {
- int l,savel,i,j,k,m,no;
- struct helptbl *helptbl;
- char buf[50],a,c,msg1[50],*msg2;
-
- allclr();
- savel = line;
- setline(0);
- l = line = getline();
- l -= 10;
- topdisp();
- pfdisp(0);
- i = 1;
- for(;;) {
- if(mode) {
- helptbl = help1tbl;
- no = HELP1NO;
- strcpy(msg1," 内容表示画面のキー操作説明");
- }
- else {
- helptbl = help2tbl;
- no = HELP2NO;
- strcpy(msg1," タイトル一覧表示画面のキー操作説明");
- }
- if(i == 1) {
- msg2 = "ESC・リターンキー:戻る SPACEキー:次頁";
- m = 1;
- }
- else if(i+l < no) {
- msg2 = "ESC・リターンキー:戻る TABキー:前頁 SPACEキー:次頁";
- m = 2;
- }
- else {
- msg2 = "ESC・リターンキー:戻る TABキー:前頁";
- m = 3;
- }
- j = (i+l-1)/l;
- k = (no+l-1)/l;
- sprintf(buf," (%d/%d)",j,k);
- strcat(msg1,buf);
- waku_disp(2,3,l+4,76,msg1,msg2);
- loc(10,5);print("機能の説明");
- loc(45,5);print("キーの種類");
- for(j=0;j < l && i+j <= no;) {
- loc(3,6+j);
- print(helptbl[i+j-1].string);
- buf[0] = 0;
- for(k=0,c=helptbl[i+j-1].code;k < 256;k++) {
- if(keytbl[k] != c || !strlen(pfkeytbl[k])) continue;
- if(strlen(buf)+strlen(pfkeytbl[k]) > 32) break;
- if(strlen(buf)) strcat(buf,",");
- strcat(buf,pfkeytbl[k]);
- }
- loc(45,6+j);print(buf);
- j++;
- }
- loc(6,l+7);print("JUMP@ 「 」:前後の内容へ 「-」:MAIL/HP/MESの内容へ 「*」:未読の内容へ");
- locate(1,1);
- regs.x.ax = 0x0cff;
- xintdos();
- for(;a = getch();) {
- if(a == 0xff) {
- getch();
- continue;
- }
- if(a == 0x1b || a == '\r') {
- j = 0;
- break;
- }
- if(a == 0x09) { /* TABキー */
- if(m == 1) continue;
- j = 2;
- break;
- }
- if(a == ' ') { /* SPACEキー */
- if(m == 3) continue;
- j = 1;
- break;
- }
- }
- if(j == 0) break;
- if(j == 1) i += l;
- if(j == 2) i -= l;
- }
- allclr();
- line = savel;
- setline(line);
- }
-
- PCELL far *tbl_alloc(int mode) /* タイトルテーブル獲得 & 初期化 */
- {
- PCELL3 far *pt;
- PCELL2 far *pt1;
- PCELL far *pt2;
- PCELL far *pt3;
- int i;
-
- if(!p_freetop) {
- pt = (PCELL3 far *)farmalloc(sizeof(PCELL3));
- if(!pt) {
- return((PCELL far *)0);
- }
- if(emsno) {
- if(emsno != 999 && ems_count >= emsno) {
- farfree(pt);
- return((PCELL far *)0);
- }
- if(ems_add(ems_count+1)) {
- farfree(pt);
- return((PCELL far *)0);
- }
- ems_set(ems_count);
- ems_lno = ems_count;
- ems_count++;
- ems_seg = ems_getseg();
- pt1 = (PCELL2 far *)MK_FP(ems_seg,0);
- }
- else {
- pt1 = farmalloc(sizeof(PCELL2) * MAXTBL);
- if(!pt1) {
- farfree(pt);
- return((PCELL far *)0);
- }
- }
- _fmemset((char far *)pt,0,sizeof(PCELL3));
- _fmemset((char far *)pt1,0,sizeof(PCELL2) * MAXTBL);
- for(p_freetop = pt2 = (PCELL far *)pt->tbl,i=0;i < MAXTBL;) {
- if(emsno) pt2->lno = ems_lno;
- else pt2->lno = i;
- pt2->p = pt1;
- pt1++;
- if(++i >= MAXTBL) break;
- pt3 = (PCELL far *)(pt2+1);
- pt2->next = pt3;
- pt2 = pt3;
- }
- pt2->next = (PCELL far *)0;
- /* if(p_tbltop) {
- p_tbltop->next = pt;
- }
- else {
- p_tbltop = pt;
- }
- pt->next = (PCELL3 far *)0; */
- pt->next = p_tbltop;
- p_tbltop = pt;
- }
- if(!mode) {
- pt2 = p_freetop;
- p_freetop = pt2->next;
- pt2->next = pt2->back = pt2->grp = (PCELL far *)0;
- pt2->mode = pt2->flag = 0;
- pt2->count = 0;
- pt1 = pt2->p;
- tbl_set(pt2);
- _fmemset((char far *)pt1,0,sizeof(PCELL2));
- return(pt2);
- }
- return(p_freetop);
- }
-
- void tbl_free(PCELL far *pt) /* タイトルテーブル返却 */
- {
- if(pt) {
- pt->next = p_freetop;
- p_freetop = pt;
- }
- }
-
- void tbl_set(PCELL far *pt) /* EMSメモリ空間セット */
- {
- if(emsno && ems_lno != pt->lno) {
- ems_set(pt->lno);
- ems_lno = pt->lno;
- }
- }
- static int ems_func(char i) /* EMS機能呼び出しサブ */
- {
- regs.h.ah = i;
- int86x(0x67,®s,®s,&sregs);
- i = regs.h.ah;
- return((int)i);
- }
-
- static char emsname[9] = "NIFP0 ";
- int ems_add(int no) /* EMS1ページ獲得 */
- {
- int i;
-
- if(no == 1) {
- regs.x.bx = 1;
- if(ems_func(0x43)) return(-1);
- ems_handle = regs.x.dx;
- for(i=0;i<10;i++) {
- sprintf(&emsname[4],"%d",i);
- regs.h.al = 1;
- regs.x.si = (unsigned)emsname;
- if(ems_func(0x54)) break;
- }
- regs.h.al = 1;
- regs.x.dx = ems_handle;
- regs.x.si = (unsigned)emsname;
- if(ems_func(0x53)) {
- ems_free();
- return(-1);
- }
- }
- else {
- regs.x.bx = no;
- regs.x.dx = ems_handle;
- if(ems_func(0x51)) return(-1);
- }
- return(0);
- }
-
- int ems_set(int no) /* EMSを物理アドレスにマップ */
- {
- regs.x.bx = no;
- regs.h.al = 0;
- regs.x.dx = ems_handle;
- if(ems_func(0x44)) return(-1);
- return(0);
- }
-
- int ems_check(void) /* EMSが存在するかチェック */
- {
- char far *add;
-
- regs.h.ah = 0x35;
- regs.h.al = 0x67;
- intdosx(®s,®s,&sregs);
- add = (char far *)MK_FP(sregs.es,0x000a);
- if(*add++ != 'E' || *add++ != 'M' || *add != 'M') {
- return(0);
- }
- return(1);
- }
-
- long ems_getseg(void) /* EMS物理セグメントアドレス読み込み */
- {
- ems_func(0x41);
- return((long)regs.x.bx);
- }
-
- int ems_free(void) /* EMS返却 */
- {
- if(ems_count) {
- regs.x.dx = ems_handle;
- if(ems_func(0x45)) return(-1);
- ems_count = 0;
- }
- return(0);
- }
-
- /*
- char far *_fstrcpy(char far *d,char far *s) {
- for(;;) {
- *d++ = *s;
- if(!*s++) break;
- }
- return(d);
- }
-
- char far *_fstrncpy(char far *d,char far *s,int n) {
- for(;n;n--) {
- *d++ = *s;
- if(!*s++) break;
- }
- return(d);
- }
-
- int _fstrcmp(char far *s1,char far *s2) {
- for(;*s1 && *s2;) {
- if(*s1 < *s2) return(-1);
- if(*s1 > *s2) return(1);
- s1++;
- s2++;
- }
- return(0);
- }
-
- char far *_fmemset(char far *s,char c,int n) {
- for(;n;n--)
- *s++ = c;
- return(s);
- }
-
- char far *_fmemcpy(char far *d,char far *s,int n) {
- for(;n;n--)
- *d++ = *s++;
- return(d);
- }
-
- int _fmemcmp(char far *s1,char far *s2,int n) {
- for(;n;n--) {
- if(*s1 < *s2) return(-1);
- if(*s1 > *s2) return(1);
- s1++;
- s2++;
- }
- return(0);
- }
- */